We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2df6437 commit 614e761Copy full SHA for 614e761
src/fromsixel.c
@@ -884,7 +884,10 @@ sixel_decode_raw(
884
}
885
886
*ncolors = image.ncolors + 1;
887
- *palette = (unsigned char *)sixel_allocator_malloc(allocator, (size_t)(*ncolors * 3));
+ int alloc_size = *ncolors;
888
+ if (alloc_size < 256) // memory access range should be 0 <= 255 (in write_png_to_file)
889
+ alloc_size = 256;
890
+ *palette = (unsigned char *)sixel_allocator_malloc(allocator, (size_t)(alloc_size * 3));
891
if (palette == NULL) {
892
sixel_allocator_free(allocator, image.data);
893
sixel_helper_set_additional_message(
0 commit comments