@@ -141,15 +141,15 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val
141
141
uint16_t x = 0 ;
142
142
uint16_t y = 0 ;
143
143
if (mp_obj_is_small_int (index_obj )) {
144
- mp_int_t i = MP_OBJ_SMALL_INT_VALUE (index_obj );
144
+ mp_int_t i = mp_arg_validate_int_min ( MP_OBJ_SMALL_INT_VALUE (index_obj ), 0 , MP_QSTR_index );
145
145
uint16_t width = common_hal_displayio_bitmap_get_width (self );
146
146
x = i % width ;
147
147
y = i / width ;
148
148
} else {
149
149
mp_obj_t * items ;
150
150
mp_obj_get_array_fixed_n (index_obj , 2 , & items );
151
- x = mp_obj_get_int (items [0 ]);
152
- y = mp_obj_get_int (items [1 ]);
151
+ x = mp_arg_validate_int_min ( mp_obj_get_int (items [0 ]), 0 , MP_QSTR_x );
152
+ y = mp_arg_validate_int_min ( mp_obj_get_int (items [1 ]), 0 , MP_QSTR_y );
153
153
if (x >= common_hal_displayio_bitmap_get_width (self ) || y >= common_hal_displayio_bitmap_get_height (self )) {
154
154
mp_raise_IndexError (translate ("pixel coordinates out of bounds" ));
155
155
}
@@ -286,7 +286,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(displayio_bitmap_blit_obj, 1, displayio_bitmap_obj_bl
286
286
STATIC mp_obj_t displayio_bitmap_obj_fill (mp_obj_t self_in , mp_obj_t value_obj ) {
287
287
displayio_bitmap_t * self = MP_OBJ_TO_PTR (self_in );
288
288
289
- mp_uint_t value = (mp_uint_t )mp_obj_get_int (value_obj );
289
+ mp_uint_t value = (mp_uint_t )mp_arg_validate_int_min ( mp_obj_get_int (value_obj ), 0 , MP_QSTR_value );
290
290
if ((value >> common_hal_displayio_bitmap_get_bits_per_value (self )) != 0 ) {
291
291
mp_raise_ValueError (translate ("pixel value requires too many bits" ));
292
292
}
0 commit comments