Skip to content

Commit 5f3f87e

Browse files
committed
validate palette color count and group scale
1 parent 67fd815 commit 5f3f87e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

shared-bindings/displayio/Group.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ STATIC mp_obj_t displayio_group_make_new(const mp_obj_type_t *type, size_t n_arg
5656
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
5757
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
5858

59-
mp_int_t scale = mp_arg_validate_int_min(args[ARG_scale].u_int, 1, MP_QSTR_scale);
59+
mp_int_t scale = mp_arg_validate_int_range(args[ARG_scale].u_int, 1, 32767,MP_QSTR_scale);
6060

6161
displayio_group_t *self = m_new_obj(displayio_group_t);
6262
self->base.type = &displayio_group_type;

shared-bindings/displayio/Palette.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ STATIC mp_obj_t displayio_palette_make_new(const mp_obj_type_t *type, size_t n_a
5858

5959
displayio_palette_t *self = m_new_obj(displayio_palette_t);
6060
self->base.type = &displayio_palette_type;
61-
common_hal_displayio_palette_construct(self, args[ARG_color_count].u_int);
61+
common_hal_displayio_palette_construct(self, mp_arg_validate_int_range(args[ARG_color_count].u_int, 1, 32767, MP_QSTR_color_count));
6262

6363
return MP_OBJ_FROM_PTR(self);
6464
}

0 commit comments

Comments
 (0)