Skip to content

Commit fcf4655

Browse files
committed
validate bounds of pixel index in make_transparent
1 parent 562c73b commit fcf4655

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

locale/circuitpython.pot

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ msgstr ""
7272
#: ports/mimxrt10xx/common-hal/rtc/RTC.c
7373
#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c
7474
#: ports/raspberrypi/common-hal/analogio/AnalogOut.c
75-
#: ports/raspberrypi/common-hal/rtc/RTC.c
75+
#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/rtc/RTC.c
7676
msgid "%q"
7777
msgstr ""
7878

@@ -432,7 +432,6 @@ msgstr ""
432432
msgid "All event channels in use"
433433
msgstr ""
434434

435-
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
436435
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
437436
msgid "All state machines in use"
438437
msgstr ""
@@ -518,7 +517,7 @@ msgstr ""
518517
msgid "AuthMode.OPEN is not used with password"
519518
msgstr ""
520519

521-
#: shared-bindings/wifi/Radio.c
520+
#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c
522521
msgid "Authentication failure"
523522
msgstr ""
524523

@@ -3687,6 +3686,10 @@ msgstr ""
36873686
msgid "palette must be 32 bytes long"
36883687
msgstr ""
36893688

3689+
#: shared-bindings/displayio/Palette.c
3690+
msgid "palette_index out of bounds"
3691+
msgstr ""
3692+
36903693
#: shared-bindings/displayio/Palette.c
36913694
msgid "palette_index should be an int"
36923695
msgstr ""
@@ -3915,10 +3918,6 @@ msgstr ""
39153918
msgid "source_bitmap must have value_count of 8"
39163919
msgstr ""
39173920

3918-
#: shared-bindings/wifi/Radio.c
3919-
msgid "ssid can't be more than 32 bytes"
3920-
msgstr ""
3921-
39223921
#: py/objstr.c
39233922
msgid "start/end indices"
39243923
msgstr ""

shared-bindings/displayio/Palette.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ STATIC mp_obj_t displayio_palette_obj_make_transparent(mp_obj_t self_in, mp_obj_
160160
if (!mp_obj_get_int_maybe(palette_index_obj, &palette_index)) {
161161
mp_raise_ValueError(translate("palette_index should be an int"));
162162
}
163+
if (palette_index < 0 || (unsigned)palette_index >= common_hal_displayio_palette_get_len(self)) {
164+
mp_raise_IndexError(translate("palette_index out of bounds"));
165+
}
166+
163167
common_hal_displayio_palette_make_transparent(self, palette_index);
164168
return mp_const_none;
165169
}

0 commit comments

Comments
 (0)