Skip to content

esp32/machine_sdcard.c: Invalid pin numbers are allowed. #8112

Closed
@IhorNehrutsa

Description

@IhorNehrutsa

STATIC gpio_num_t pin_or_int(const mp_obj_t arg) {
if (mp_obj_is_small_int(arg)) {
return MP_OBJ_SMALL_INT_VALUE(arg);
} else {
// This raises a value error if the argument is not a Pin.
return machine_pin_get_id(arg);
}
}

@nickovs

This function does not check int value.

    return MP_OBJ_SMALL_INT_VALUE(arg);

may return invalid pin numbers like 12345

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions