Skip to content

Commit 67fd815

Browse files
committed
maximum value validation for bitmap constructor
1 parent bb4cccc commit 67fd815

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

shared-bindings/displayio/Bitmap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@
6262
//| ...
6363
STATIC mp_obj_t displayio_bitmap_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
6464
mp_arg_check_num(n_args, n_kw, 3, 3, false);
65-
uint32_t width = mp_arg_validate_int_min(mp_obj_get_int(all_args[0]), 1, MP_QSTR_width);
66-
uint32_t height = mp_arg_validate_int_min(mp_obj_get_int(all_args[1]), 1, MP_QSTR_height);
67-
uint32_t value_count = mp_arg_validate_int_min(mp_obj_get_int(all_args[2]), 1, MP_QSTR_value_count);
65+
uint32_t width = mp_arg_validate_int_range(mp_obj_get_int(all_args[0]), 1, 32767, MP_QSTR_width);
66+
uint32_t height = mp_arg_validate_int_range(mp_obj_get_int(all_args[1]), 1, 32767, MP_QSTR_height);
67+
uint32_t value_count = mp_arg_validate_int_range(mp_obj_get_int(all_args[2]), 1, 32767, MP_QSTR_value_count);
6868
uint32_t bits = 1;
6969

7070
while ((value_count - 1) >> bits) {

0 commit comments

Comments
 (0)