@@ -141,15 +141,15 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val
141141 uint16_t x = 0 ;
142142 uint16_t y = 0 ;
143143 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 );
145145 uint16_t width = common_hal_displayio_bitmap_get_width (self );
146146 x = i % width ;
147147 y = i / width ;
148148 } else {
149149 mp_obj_t * items ;
150150 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 );
153153 if (x >= common_hal_displayio_bitmap_get_width (self ) || y >= common_hal_displayio_bitmap_get_height (self )) {
154154 mp_raise_IndexError (translate ("pixel coordinates out of bounds" ));
155155 }
@@ -286,7 +286,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(displayio_bitmap_blit_obj, 1, displayio_bitmap_obj_bl
286286STATIC mp_obj_t displayio_bitmap_obj_fill (mp_obj_t self_in , mp_obj_t value_obj ) {
287287 displayio_bitmap_t * self = MP_OBJ_TO_PTR (self_in );
288288
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 );
290290 if ((value >> common_hal_displayio_bitmap_get_bits_per_value (self )) != 0 ) {
291291 mp_raise_ValueError (translate ("pixel value requires too many bits" ));
292292 }
0 commit comments