Merge pull request #6550 from crackmonkey/rp2040-wait-pin-bounds

issue adafruit#6538 loose bounds checking on WAIT PIO instruction
This commit is contained in:
Scott Shawcroft 2022-07-05 12:56:14 -07:00 committed by GitHub
commit 18d7165e0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -436,7 +436,7 @@ void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self,
if (first_in_pin == NULL) { if (first_in_pin == NULL) {
mp_raise_ValueError_varg(translate("Missing first_in_pin. Instruction %d waits based on pin"), i); mp_raise_ValueError_varg(translate("Missing first_in_pin. Instruction %d waits based on pin"), i);
} }
if (wait_index > in_pin_count) { if (wait_index >= in_pin_count) {
mp_raise_ValueError_varg(translate("Instruction %d waits on input outside of count"), i); mp_raise_ValueError_varg(translate("Instruction %d waits on input outside of count"), i);
} }
} }