Skip to content

Commit

Permalink
allow larger images (depending on bpp): fixes #649
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed Oct 19, 2023
1 parent 4a71ef6 commit e568240
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion runtime/devicescript/impl_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ void fun5_Image_alloc(devs_ctx_t *ctx) {
int offset = devs_arg_int(ctx, 4);
uint8_t *pix = NULL;

if (width <= 0 || height <= 0 || width * height > DEVS_MAX_ALLOC || (bpp != 1 && bpp != 4)) {
if (width <= 0 || height <= 0 || (bpp != 1 && bpp != 4) ||
bpp * width * height > 8 * DEVS_MAX_ALLOC) {
devs_throw_range_error(ctx, "invalid dimensions %dx%dx%d", width, height, bpp);
return;
}
Expand Down

0 comments on commit e568240

Please sign in to comment.