Skip to content

Commit 5f64fb1

Browse files
committed
add limitation to width and height
1 parent 2df6437 commit 5f64fb1

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/sixel.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,9 @@ typedef int SIXELSTATUS;
366366
#define SIXEL_OPTFLAG_VERSION ('V') /* -V, --version: show version and license info */
367367
#define SIXEL_OPTFLAG_HELP ('H') /* -H, --help: show this help */
368368

369+
#define SIXEL_WIDTH_LIMIT 1000000
370+
#define SIXEL_HEIGHT_LIMIT 1000000
371+
369372
#if SIXEL_USE_DEPRECATED_SYMBOLS
370373
/* output character size */
371374
enum characterSize {

src/decoder.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,11 @@ sixel_decoder_decode(
315315
goto end;
316316
}
317317

318+
if (sx > SIXEL_WIDTH_LIMIT || sy > SIXEL_HEIGHT_LIMIT) {
319+
status = SIXEL_BAD_INPUT;
320+
goto end;
321+
}
322+
318323
status = sixel_helper_write_image_file(indexed_pixels, sx, sy, palette,
319324
SIXEL_PIXELFORMAT_PAL8,
320325
decoder->output,

0 commit comments

Comments
 (0)