Skip to content

Commit 029150a

Browse files
committed
validate initial point is in-bounds
1 parent 6f78306 commit 029150a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

shared-bindings/bitmaptools/__init__.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,12 @@ STATIC mp_obj_t bitmaptools_obj_boundary_fill(size_t n_args, const mp_obj_t *pos
345345
int16_t x = args[ARG_x].u_int;
346346
int16_t y = args[ARG_y].u_int;
347347

348+
if (x < 0 || x >= destination->width) {
349+
mp_raise_ValueError(translate("out of range of target"));
350+
}
351+
if (y < 0 || y >= destination->height) {
352+
mp_raise_ValueError(translate("out of range of target"));
353+
}
348354

349355
common_hal_bitmaptools_boundary_fill(destination, x, y, value, background_value);
350356

0 commit comments

Comments
 (0)