Skip to content
Permalink
Browse files Browse the repository at this point in the history
Avoid illegal memory access problem with 1 color paletted png(#73),
Thanks to HongxuChen.
  • Loading branch information
saitoha committed Dec 15, 2019
1 parent a515d2c commit cb373ab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/dither.c
Expand Up @@ -284,9 +284,13 @@ sixel_dither_new(
quality_mode = SIXEL_QUALITY_HIGHCOLOR;
} else {
if (ncolors > SIXEL_PALETTE_MAX) {
status = SIXEL_BAD_INPUT;
ncolors = 256;
} else if (ncolors < 2) {
ncolors = 2;
} else if (ncolors < 1) {
status = SIXEL_BAD_INPUT;
sixel_helper_set_additional_message(
"sixel_dither_new: palette colors must be more than 0");
goto end;
}
quality_mode = SIXEL_QUALITY_LOW;
}
Expand Down

0 comments on commit cb373ab

Please sign in to comment.