Skip to content

Commit

Permalink
add limitation to width and height
Browse files Browse the repository at this point in the history
  • Loading branch information
knok committed Aug 1, 2019
1 parent 2df6437 commit 5f64fb1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/sixel.h.in
Expand Up @@ -366,6 +366,9 @@ typedef int SIXELSTATUS;
#define SIXEL_OPTFLAG_VERSION ('V') /* -V, --version: show version and license info */
#define SIXEL_OPTFLAG_HELP ('H') /* -H, --help: show this help */

#define SIXEL_WIDTH_LIMIT 1000000
#define SIXEL_HEIGHT_LIMIT 1000000

#if SIXEL_USE_DEPRECATED_SYMBOLS
/* output character size */
enum characterSize {
Expand Down
5 changes: 5 additions & 0 deletions src/decoder.c
Expand Up @@ -315,6 +315,11 @@ sixel_decoder_decode(
goto end;
}

if (sx > SIXEL_WIDTH_LIMIT || sy > SIXEL_HEIGHT_LIMIT) {
status = SIXEL_BAD_INPUT;
goto end;
}

status = sixel_helper_write_image_file(indexed_pixels, sx, sy, palette,
SIXEL_PIXELFORMAT_PAL8,
decoder->output,
Expand Down

0 comments on commit 5f64fb1

Please sign in to comment.