From c66d8aa75436f334f686fe32bca8e414bcdd18e6 Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Mon, 2 Mar 2020 22:57:23 +0000 Subject: [PATCH 01/11] Fli issue 1 --- src/libImaging/FliDecode.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/libImaging/FliDecode.c b/src/libImaging/FliDecode.c index 6f48c07d415..484f1ce686a 100644 --- a/src/libImaging/FliDecode.c +++ b/src/libImaging/FliDecode.c @@ -165,14 +165,26 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt break; case 15: /* FLI BRUN chunk */ + /* data = ptr + 6 */ for (y = 0; y < state->ysize; y++) { UINT8* out = (UINT8*) im->image[y]; data += 1; /* ignore packetcount byte */ for (x = 0; x < state->xsize; x += i) { + if (data + 2 > ptr + bytes ) { + /* Out of Bounds Read issue, guaranteed to try to read 2 from data */ + state->errcode = IMAGING_CODEC_OVERRUN; + return -1; + } if (data[0] & 0x80) { i = 256 - data[0]; - if (x + i > state->xsize) + if (x + i > state->xsize) { break; /* safety first */ + } + if (data + i + 1 > ptr + bytes ) { + /* Out of Bounds Read issue */ + state->errcode = IMAGING_CODEC_OVERRUN; + return -1; + } memcpy(out + x, data + 1, i); data += i + 1; } else { From f6926a041b4b544fd2ced3752542afb6c8c19405 Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Thu, 5 Mar 2020 09:11:13 +0000 Subject: [PATCH 02/11] Refactor to macro --- src/libImaging/FliDecode.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/libImaging/FliDecode.c b/src/libImaging/FliDecode.c index 484f1ce686a..d53b4a7fd17 100644 --- a/src/libImaging/FliDecode.c +++ b/src/libImaging/FliDecode.c @@ -24,7 +24,12 @@ #define I32(ptr)\ ((ptr)[0] + ((ptr)[1] << 8) + ((ptr)[2] << 16) + ((ptr)[3] << 24)) - +#define ERR_IF_DATA_OOB(offset) \ + if ((data + (offset)) > ptr + bytes) {\ + state->errcode = IMAGING_CODEC_OVERRUN; \ + return -1; \ + } + int ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t bytes) { @@ -170,21 +175,15 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt UINT8* out = (UINT8*) im->image[y]; data += 1; /* ignore packetcount byte */ for (x = 0; x < state->xsize; x += i) { - if (data + 2 > ptr + bytes ) { - /* Out of Bounds Read issue, guaranteed to try to read 2 from data */ - state->errcode = IMAGING_CODEC_OVERRUN; - return -1; - } + /* Out of Bounds Read issue, guaranteed to try to read 2 from data */ + ERR_IF_DATA_OOB(2) if (data[0] & 0x80) { i = 256 - data[0]; if (x + i > state->xsize) { break; /* safety first */ } - if (data + i + 1 > ptr + bytes ) { - /* Out of Bounds Read issue */ - state->errcode = IMAGING_CODEC_OVERRUN; - return -1; - } + /* Out of Bounds read issue */ + ERR_IF_DATA_OOB(i+1) memcpy(out + x, data + 1, i); data += i + 1; } else { From b4e439d6d7fd986cd6b4c7f9ca18830d79dacd44 Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Thu, 5 Mar 2020 09:11:50 +0000 Subject: [PATCH 03/11] Fix OOB Reads in SS2 Chunk --- src/libImaging/FliDecode.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libImaging/FliDecode.c b/src/libImaging/FliDecode.c index d53b4a7fd17..c4043615573 100644 --- a/src/libImaging/FliDecode.c +++ b/src/libImaging/FliDecode.c @@ -83,10 +83,12 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt break; /* ignored; handled by Python code */ case 7: /* FLI SS2 chunk (word delta) */ + /* OOB ok, we've got 10 bytes min on entry */ lines = I16(data); data += 2; for (l = y = 0; l < lines && y < state->ysize; l++, y++) { UINT8* buf = (UINT8*) im->image[y]; int p, packets; + ERR_IF_DATA_OOB(2) packets = I16(data); data += 2; while (packets & 0x8000) { /* flag word */ @@ -101,11 +103,14 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt /* store last byte (used if line width is odd) */ buf[state->xsize-1] = (UINT8) packets; } + ERR_IF_DATA_OOB(2) packets = I16(data); data += 2; } for (p = x = 0; p < packets; p++) { + ERR_IF_DATA_OOB(2) x += data[0]; /* pixel skip */ if (data[1] >= 128) { + ERR_IF_DATA_OOB(4) i = 256-data[1]; /* run */ if (x + i + i > state->xsize) break; @@ -118,6 +123,7 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt i = 2 * (int) data[1]; /* chunk */ if (x + i > state->xsize) break; + ERR_IF_DATA_OOB(2+i) memcpy(buf + x, data + 2, i); data += 2 + i; x += i; From c88b0204d7c930e3bd72626ae6ea078571cc0ea7 Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Thu, 5 Mar 2020 09:21:35 +0000 Subject: [PATCH 04/11] Fix OOB in LC packet --- src/libImaging/FliDecode.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libImaging/FliDecode.c b/src/libImaging/FliDecode.c index c4043615573..2316fa814dd 100644 --- a/src/libImaging/FliDecode.c +++ b/src/libImaging/FliDecode.c @@ -140,22 +140,26 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt break; case 12: /* FLI LC chunk (byte delta) */ + /* OOB Check ok, we have 10 bytes here */ y = I16(data); ymax = y + I16(data+2); data += 4; for (; y < ymax && y < state->ysize; y++) { UINT8* out = (UINT8*) im->image[y]; int p, packets = *data++; for (p = x = 0; p < packets; p++, x += i) { + ERR_IF_DATA_OOB(2) x += data[0]; /* skip pixels */ if (data[1] & 0x80) { i = 256-data[1]; /* run */ if (x + i > state->xsize) break; + ERR_IF_DATA_OOB(3) memset(out + x, data[2], i); data += 3; } else { i = data[1]; /* chunk */ if (x + i > state->xsize) break; + ERR_IF_DATA_OOB(2+i) memcpy(out + x, data + 2, i); data += i + 2; } From c5edc361fd6450f805a6a444723b0f68190b1d0c Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Thu, 5 Mar 2020 09:51:32 +0000 Subject: [PATCH 05/11] Fix OOB Advance Values --- src/libImaging/FliDecode.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libImaging/FliDecode.c b/src/libImaging/FliDecode.c index 2316fa814dd..ca9e00327f8 100644 --- a/src/libImaging/FliDecode.c +++ b/src/libImaging/FliDecode.c @@ -83,7 +83,7 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt break; /* ignored; handled by Python code */ case 7: /* FLI SS2 chunk (word delta) */ - /* OOB ok, we've got 10 bytes min on entry */ + /* OOB ok, we've got 4 bytes min on entry */ lines = I16(data); data += 2; for (l = y = 0; l < lines && y < state->ysize; l++, y++) { UINT8* buf = (UINT8*) im->image[y]; @@ -229,6 +229,10 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt return -1; } advance = I32(ptr); + if (advance < 0 || advance > bytes) { + state->errcode = IMAGING_CODEC_OVERRUN; + return -1; + } ptr += advance; bytes -= advance; } From 8d4f3c0c5f2fecf175aeb895e9c2d6d06d85bdc9 Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Thu, 5 Mar 2020 10:01:28 +0000 Subject: [PATCH 06/11] Fix OOB Read in FLI Copy Chunk --- src/libImaging/FliDecode.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/libImaging/FliDecode.c b/src/libImaging/FliDecode.c index ca9e00327f8..98bc037681e 100644 --- a/src/libImaging/FliDecode.c +++ b/src/libImaging/FliDecode.c @@ -86,7 +86,7 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt /* OOB ok, we've got 4 bytes min on entry */ lines = I16(data); data += 2; for (l = y = 0; l < lines && y < state->ysize; l++, y++) { - UINT8* buf = (UINT8*) im->image[y]; + UINT8* local_buf = (UINT8*) im->image[y]; int p, packets; ERR_IF_DATA_OOB(2) packets = I16(data); data += 2; @@ -98,10 +98,10 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt state->errcode = IMAGING_CODEC_OVERRUN; return -1; } - buf = (UINT8*) im->image[y]; + local_buf = (UINT8*) im->image[y]; } else { /* store last byte (used if line width is odd) */ - buf[state->xsize-1] = (UINT8) packets; + local_buf[state->xsize-1] = (UINT8) packets; } ERR_IF_DATA_OOB(2) packets = I16(data); data += 2; @@ -115,8 +115,8 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt if (x + i + i > state->xsize) break; for (j = 0; j < i; j++) { - buf[x++] = data[2]; - buf[x++] = data[3]; + local_buf[x++] = data[2]; + local_buf[x++] = data[3]; } data += 2 + 2; } else { @@ -124,7 +124,7 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt if (x + i > state->xsize) break; ERR_IF_DATA_OOB(2+i) - memcpy(buf + x, data + 2, i); + memcpy(local_buf + x, data + 2, i); data += 2 + i; x += i; } @@ -213,9 +213,13 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt break; case 16: /* COPY chunk */ + if (state->xsize > bytes/state->ysize) { + /* not enough data for frame */ + return ptr - buf; /* bytes consumed */ + } for (y = 0; y < state->ysize; y++) { - UINT8* buf = (UINT8*) im->image[y]; - memcpy(buf, data, state->xsize); + UINT8* local_buf = (UINT8*) im->image[y]; + memcpy(local_buf, data, state->xsize); data += state->xsize; } break; From 19ff42bd683486a8a308743c76972ef6a6482e9b Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Thu, 5 Mar 2020 10:13:10 +0000 Subject: [PATCH 07/11] tests for Fli OOB reads --- Tests/check_fli_oob.py | 61 ++++++++++++++++++++++ Tests/images/fli_oob/02r/02r00.fli | Bin 0 -> 400 bytes Tests/images/fli_oob/02r/notes | 1 + Tests/images/fli_oob/02r/others/02r01.fli | Bin 0 -> 457 bytes Tests/images/fli_oob/02r/others/02r02.fli | Bin 0 -> 400 bytes Tests/images/fli_oob/02r/others/02r03.fli | Bin 0 -> 509 bytes Tests/images/fli_oob/02r/others/02r04.fli | Bin 0 -> 156 bytes Tests/images/fli_oob/02r/reproducing | 1 + Tests/images/fli_oob/03r/03r00.fli | Bin 0 -> 1949 bytes Tests/images/fli_oob/03r/notes | 1 + Tests/images/fli_oob/03r/others/03r01.fli | Bin 0 -> 820 bytes Tests/images/fli_oob/03r/others/03r02.fli | Bin 0 -> 386 bytes Tests/images/fli_oob/03r/others/03r03.fli | Bin 0 -> 880 bytes Tests/images/fli_oob/03r/others/03r04.fli | Bin 0 -> 633 bytes Tests/images/fli_oob/03r/others/03r05.fli | Bin 0 -> 2586 bytes Tests/images/fli_oob/03r/others/03r06.fli | Bin 0 -> 784 bytes Tests/images/fli_oob/03r/others/03r07.fli | Bin 0 -> 893 bytes Tests/images/fli_oob/03r/others/03r08.fli | Bin 0 -> 784 bytes Tests/images/fli_oob/03r/others/03r09.fli | Bin 0 -> 2210 bytes Tests/images/fli_oob/03r/others/03r10.fli | Bin 0 -> 61158 bytes Tests/images/fli_oob/03r/others/03r11.fli | Bin 0 -> 60120 bytes Tests/images/fli_oob/03r/reproducing | 1 + Tests/images/fli_oob/04r/04r00.fli | Bin 0 -> 551 bytes Tests/images/fli_oob/04r/initial.fli | Bin 0 -> 4096 bytes Tests/images/fli_oob/04r/notes | 1 + Tests/images/fli_oob/04r/others/04r01.fli | Bin 0 -> 1363 bytes Tests/images/fli_oob/04r/others/04r02.fli | Bin 0 -> 725 bytes Tests/images/fli_oob/04r/others/04r03.fli | Bin 0 -> 1008 bytes Tests/images/fli_oob/04r/others/04r04.fli | Bin 0 -> 637 bytes Tests/images/fli_oob/04r/others/04r05.fli | Bin 0 -> 785 bytes Tests/images/fli_oob/04r/reproducing | 1 + Tests/images/fli_oob/05r/05r00.fli | Bin 0 -> 863 bytes Tests/images/fli_oob/05r/notes | 1 + Tests/images/fli_oob/05r/others/05r01.fli | Bin 0 -> 415 bytes Tests/images/fli_oob/05r/others/05r02.fli | Bin 0 -> 3274 bytes Tests/images/fli_oob/05r/others/05r03.fli | Bin 0 -> 1320 bytes Tests/images/fli_oob/05r/others/05r04.fli | Bin 0 -> 1190 bytes Tests/images/fli_oob/05r/others/05r05.fli | Bin 0 -> 11135 bytes Tests/images/fli_oob/05r/others/05r06.fli | Bin 0 -> 619 bytes Tests/images/fli_oob/05r/others/05r07.fli | Bin 0 -> 672 bytes Tests/images/fli_oob/05r/reproducing | 1 + Tests/images/fli_oob/06r/06r00.fli | Bin 0 -> 1083 bytes Tests/images/fli_oob/06r/notes | 1 + Tests/images/fli_oob/06r/others/06r01.fli | Bin 0 -> 1014 bytes Tests/images/fli_oob/06r/others/06r02.fli | Bin 0 -> 1082 bytes Tests/images/fli_oob/06r/others/06r03.fli | Bin 0 -> 919 bytes Tests/images/fli_oob/06r/others/06r04.fli | Bin 0 -> 916 bytes Tests/images/fli_oob/06r/reproducing | 1 + 48 files changed, 71 insertions(+) create mode 100644 Tests/check_fli_oob.py create mode 100644 Tests/images/fli_oob/02r/02r00.fli create mode 100644 Tests/images/fli_oob/02r/notes create mode 100644 Tests/images/fli_oob/02r/others/02r01.fli create mode 100644 Tests/images/fli_oob/02r/others/02r02.fli create mode 100644 Tests/images/fli_oob/02r/others/02r03.fli create mode 100644 Tests/images/fli_oob/02r/others/02r04.fli create mode 100644 Tests/images/fli_oob/02r/reproducing create mode 100644 Tests/images/fli_oob/03r/03r00.fli create mode 100644 Tests/images/fli_oob/03r/notes create mode 100644 Tests/images/fli_oob/03r/others/03r01.fli create mode 100644 Tests/images/fli_oob/03r/others/03r02.fli create mode 100644 Tests/images/fli_oob/03r/others/03r03.fli create mode 100644 Tests/images/fli_oob/03r/others/03r04.fli create mode 100644 Tests/images/fli_oob/03r/others/03r05.fli create mode 100644 Tests/images/fli_oob/03r/others/03r06.fli create mode 100644 Tests/images/fli_oob/03r/others/03r07.fli create mode 100644 Tests/images/fli_oob/03r/others/03r08.fli create mode 100644 Tests/images/fli_oob/03r/others/03r09.fli create mode 100644 Tests/images/fli_oob/03r/others/03r10.fli create mode 100644 Tests/images/fli_oob/03r/others/03r11.fli create mode 100644 Tests/images/fli_oob/03r/reproducing create mode 100644 Tests/images/fli_oob/04r/04r00.fli create mode 100644 Tests/images/fli_oob/04r/initial.fli create mode 100644 Tests/images/fli_oob/04r/notes create mode 100644 Tests/images/fli_oob/04r/others/04r01.fli create mode 100644 Tests/images/fli_oob/04r/others/04r02.fli create mode 100644 Tests/images/fli_oob/04r/others/04r03.fli create mode 100644 Tests/images/fli_oob/04r/others/04r04.fli create mode 100644 Tests/images/fli_oob/04r/others/04r05.fli create mode 100644 Tests/images/fli_oob/04r/reproducing create mode 100644 Tests/images/fli_oob/05r/05r00.fli create mode 100644 Tests/images/fli_oob/05r/notes create mode 100644 Tests/images/fli_oob/05r/others/05r01.fli create mode 100644 Tests/images/fli_oob/05r/others/05r02.fli create mode 100644 Tests/images/fli_oob/05r/others/05r03.fli create mode 100644 Tests/images/fli_oob/05r/others/05r04.fli create mode 100644 Tests/images/fli_oob/05r/others/05r05.fli create mode 100644 Tests/images/fli_oob/05r/others/05r06.fli create mode 100644 Tests/images/fli_oob/05r/others/05r07.fli create mode 100644 Tests/images/fli_oob/05r/reproducing create mode 100644 Tests/images/fli_oob/06r/06r00.fli create mode 100644 Tests/images/fli_oob/06r/notes create mode 100644 Tests/images/fli_oob/06r/others/06r01.fli create mode 100644 Tests/images/fli_oob/06r/others/06r02.fli create mode 100644 Tests/images/fli_oob/06r/others/06r03.fli create mode 100644 Tests/images/fli_oob/06r/others/06r04.fli create mode 100644 Tests/images/fli_oob/06r/reproducing diff --git a/Tests/check_fli_oob.py b/Tests/check_fli_oob.py new file mode 100644 index 00000000000..ca06c2cb825 --- /dev/null +++ b/Tests/check_fli_oob.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +from PIL import Image + +repro_ss2 = ('images/fli_oob/06r/06r00.fli', + 'images/fli_oob/06r/others/06r01.fli', + 'images/fli_oob/06r/others/06r02.fli', + 'images/fli_oob/06r/others/06r03.fli', + 'images/fli_oob/06r/others/06r04.fli' +) + +repro_lc = ('images/fli_oob/05r/05r00.fli', + 'images/fli_oob/05r/others/05r03.fli', + 'images/fli_oob/05r/others/05r06.fli', + 'images/fli_oob/05r/others/05r05.fli', + 'images/fli_oob/05r/others/05r01.fli', + 'images/fli_oob/05r/others/05r04.fli', + 'images/fli_oob/05r/others/05r02.fli', + 'images/fli_oob/05r/others/05r07.fli', +) + + +repro_advance = ('images/fli_oob/03r/03r00.fli', + 'images/fli_oob/03r/others/03r01.fli', + 'images/fli_oob/03r/others/03r09.fli', + 'images/fli_oob/03r/others/03r11.fli', + 'images/fli_oob/03r/others/03r05.fli', + 'images/fli_oob/03r/others/03r10.fli', + 'images/fli_oob/03r/others/03r06.fli', + 'images/fli_oob/03r/others/03r08.fli', + 'images/fli_oob/03r/others/03r03.fli', + 'images/fli_oob/03r/others/03r07.fli', + 'images/fli_oob/03r/others/03r02.fli', + 'images/fli_oob/03r/others/03r04.fli', +) + +repro_brun = ('images/fli_oob/04r/initial.fli', + 'images/fli_oob/04r/others/04r02.fli', + 'images/fli_oob/04r/others/04r05.fli', + 'images/fli_oob/04r/others/04r04.fli', + 'images/fli_oob/04r/others/04r03.fli', + 'images/fli_oob/04r/others/04r01.fli', + 'images/fli_oob/04r/04r00.fli', +) + +repro_copy = ('images/fli_oob/02r/others/02r02.fli', + 'images/fli_oob/02r/others/02r04.fli', + 'images/fli_oob/02r/others/02r03.fli', + 'images/fli_oob/02r/others/02r01.fli', + 'images/fli_oob/02r/02r00.fli', +) + + +for path in repro_ss2 + repro_lc + repro_advance + repro_brun + repro_copy: + im = Image.open(path) + try: + im.load() + except Exception as msg: + print(msg) + + diff --git a/Tests/images/fli_oob/02r/02r00.fli b/Tests/images/fli_oob/02r/02r00.fli new file mode 100644 index 0000000000000000000000000000000000000000..eac0e4304f229dd292d6a91e238f961da6ef6de7 GIT binary patch literal 400 zcmb7=F$w}P5Jf-HW^IhM;2CVw=KvnUd#tVC4JCcMGiEJkD(MOKJW)Cb^0 U6zZ7mv+tii1C2uC=~;2u10_eYy#N3J literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/02r/notes b/Tests/images/fli_oob/02r/notes new file mode 100644 index 00000000000..49f92b19bed --- /dev/null +++ b/Tests/images/fli_oob/02r/notes @@ -0,0 +1 @@ +Is this because a file-originating field is being interpreted as a *signed* int32, allowing it to provide negative values for 'advance'? diff --git a/Tests/images/fli_oob/02r/others/02r01.fli b/Tests/images/fli_oob/02r/others/02r01.fli new file mode 100644 index 0000000000000000000000000000000000000000..3a5864c84c5e89e44f875af8100a1a586d9b6af3 GIT binary patch literal 457 zcmb7AOAY}+5Pj3J7z881f<#Rb zeX3Kfm9PiK;6)lS%Zqu(pAYHZQM7x^7~&drpAFKyfYSThR6NVEy9Oyl@*iMBD4i)B zvtm+rq&gE?BT}T6yJNRlMK>zpZxykbD$2bT`5%g8mc$w(yc7k7C9tzw4FJ%aO6D#z Rcbz^PEA>!5BX7WS#1IW{-=Y#N`e@7?Qe3S%X#}Z<42a zbOr?{pa!3k&}?mzQJBOGb2J@~0A;<>ahV{^3$X1g3^Rc_uBnB%PvNw|W!IBiMnn-( zMMiRtT$NM!rqY7)Ws5@gt-{(@Vfdp^dPy8G!;ivgIUpZUMu@Y*0Bsm6WR5>8fXWIp ShrTmOglH~SRCAeXL-YZ)H=7Iq literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/02r/others/02r03.fli b/Tests/images/fli_oob/02r/others/02r03.fli new file mode 100644 index 0000000000000000000000000000000000000000..a631721321a6710e40692dc1912a441a7ccd0c8c GIT binary patch literal 509 zcmbtQJ8r^25PexW5)jET4F!=PN1$~TDe_T#23pf1j^L65C&%v_-AUrBF&0V*-(DSfxTEfLGB&>%pn$UyXKS@bd>3!O5jDx^UsajHH0 znjyN{;ZXtw-Q~jf7ZdttJPBPr;Pc54{Ww(*W8CliFeY12TJ~j}*yM9_0+$X7)u1Vz qs5JhonNx<1aQ^-G|L*_)|KBj&V`BLK|0|H$AjQDI z%fL9B;s0Nt2vF(Y|NoC2JN8%l|5G66KLbdVfguGVeV0M(FOpgRAZ9Ue8fsWt{&xVX TX884y8DcRbgc1N!TtE{52%|%c literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/02r/reproducing b/Tests/images/fli_oob/02r/reproducing new file mode 100644 index 00000000000..3286d94f1c7 --- /dev/null +++ b/Tests/images/fli_oob/02r/reproducing @@ -0,0 +1 @@ +Image.open(...).seek(212) diff --git a/Tests/images/fli_oob/03r/03r00.fli b/Tests/images/fli_oob/03r/03r00.fli new file mode 100644 index 0000000000000000000000000000000000000000..7972880cecd8cc0f9b094481ccef2915b59e5782 GIT binary patch literal 1949 zcmd5-%}&BV5dLh?2=NCJqlt;|91s&Z^ig;XBOZMQjy`~|;0cdD18_4W$^nT=`#ICn zvUIx@gHh+u{bu&-?CkX0E<@bb?kYePRU$EeSf0HN9yua82D_->m3)C0j=9TT6=%Yn zr~Ep336CWN9>}T0>CJc=vI7PZkwCzMhkmo!ziu?=>H{Z7@*r-2_la;c6d6aQ1nM}{ zhos<@0<|SI_JQLB{QS7LY09>p;BYmhn_G*@S=4-s4Qrw?Br6_RI+ABP9YS=&-y0xq>qV3kR%ZP93&E!OHEdpz5#e5ye zThU+?F23LmO;Sr7-}mJY6CV^UQ0$`vG-OOP^<>{dU70Ntljyp-5JzsQmQjie-Y+N2 XLY7ezNeODsa>(RTlyY|La@hL>W6fPk literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/03r/notes b/Tests/images/fli_oob/03r/notes new file mode 100644 index 00000000000..d75605cea64 --- /dev/null +++ b/Tests/images/fli_oob/03r/notes @@ -0,0 +1 @@ +ridiculous bytes value passed to ImagingFliDecode diff --git a/Tests/images/fli_oob/03r/others/03r01.fli b/Tests/images/fli_oob/03r/others/03r01.fli new file mode 100644 index 0000000000000000000000000000000000000000..1102c69ca3b0cd47c1c9763168605a54b799c2c9 GIT binary patch literal 820 zcmb_aF>b;@5S+6pFp(ltP>?1(A`NM1Ej(46z(1Cjqj<@q!uRn{~&vA410Wk)$b?`@sk__ z=PDV*Rcx)CF}2EFCwA2hM!0M@svH-8Ek9Yl*nAutPC5p7a>|<$^QawbQ!-OHlqY>Z ukBP~H>2jk$DP#qHhrqomLP8Nz@&;t6`2un;bZhWhfJxzJrxrc5)g=eG22jBO literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/03r/others/03r02.fli b/Tests/images/fli_oob/03r/others/03r02.fli new file mode 100644 index 0000000000000000000000000000000000000000..d30326fe0b0e6054a0a8b20b727e9722bb848605 GIT binary patch literal 386 zcmZWkJx&5a7=1Ir#FfM>g&|-99Kg~B8=LVKl-$EDY&-)Ei3i{S^iXmEO^mVJM7KZ% zcINp8nS{jGeDnRhpJBjLYi5Bw2a(|3vX9Nn%Dj^-!2)OaV*3X+lsx4m-`~~g{<25< zP_Y4TL9R8Y{pMBR81yJN8hD;B7lYxV;IKwB`N;AS*jDmSAf)pTOkUa?J=K}l{V}H( z2DtMIEXy0+IETur+sZ(hq)->c^xAZI;=yNdqOf#xhXGn~A6x3H2S_sTPjWZLNLvpn pe8xXMkfHQq?8J!a??p|%4&5jObd0JXI{K=}s7#`-Z^`Ts;unC?qL=^x literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/03r/others/03r03.fli b/Tests/images/fli_oob/03r/others/03r03.fli new file mode 100644 index 0000000000000000000000000000000000000000..7f3db178e60cfd29ea665f4df68899da2804838e GIT binary patch literal 880 zcmds0JxT*X6#jPIB8ecYXb~3@!7GTcHa6oetRxrk1WD@|(nLIfwHMIRUX+M}B1SYt z3`utP^P3s7hzK@TKG=D0-p{aL@pVQfax#<7Cv=) zG%C%&v6pR8b1Frr3~rsCy|n+TG*F$8ydu$UzPlF`Dwqv7=QE1ca-=#R_hiehuUuL zQa6J+N)EoFZ8^P;8=@uIuy_z@)nCE3;|z{uSgGf|B;kT2pQ o4Gc|jR4FjoR|zq+C6qx(5+7vEWKjk+T#$Z<-6vKpy}RM_h#Z0us(7cJz|V)QFb00H-QgZe0)Bok7G-hK;fhh%;c8`ip`p^7$1kdo7dI zOEQYgtFzKN|4G*Ri>wbvrgp24@k2!akU7ONxcA^PCNDW~VyUp`?szZ;DZ0d_(O*+# zceOYtKl{MGz6c17MbkVYgTknsfHTFyyx{@IrMWbPxi5p6=Bic5DT|2Y(A(u$ySN2o zxzb!2v=3^0(-ozPxv#RMk@MaZmV)W&)ItuU`D&%Jj)v>S(oUt)qg>w=-%>z$+wm8J CXa;5g literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/03r/others/03r05.fli b/Tests/images/fli_oob/03r/others/03r05.fli new file mode 100644 index 0000000000000000000000000000000000000000..0379443241918d6ebf3e7d6e6ea6745861dd1794 GIT binary patch literal 2586 zcmd5;&ubGw6nMRDY*p}BpNav@ zx|A?Yd4X(96Iupo9h!i0qUm}TLj8Q~5N=Yy6~HCR0nN82WMGnyb5-&$BNRA?GzAO{?HzUPN+-W5}YU*_5MC1;8?6S0okmmjmdd zb0ft!`7>z7A=Kz) zUIrh7J$e-K5!K0+NCYkVh<9~rl$MtRyDuwFwhXeY@H0sVZyaT%O|>qvtPFA+cUh79 zuJohJ%KMPwqBusuvot8miZg8WpOuwc`X4=10%nI-pff#ReJ#XS1qeS8fAIjQ_v%;< zz&mlT{<8z%ZKq$AZs_}~X{Q;3n8rxu1c8E7WWSRDd8hf4NlT?yZsz0qzcDD(!t{)E z;CDGw>;I1b%c5sO+_r7YF4**t_(e~LmGxXTgP*=$d|4xTR+}qTsI8SswNks=OLQkN z7w0baB5$}O{xtR?mN8DxkXUhTy>o=#TLy$hgZAHLQ#(2%$Q7GRI18_48|zqi<~0L#@uGN zvZzb*`h!E#XA>6TBan&mjHaw-?0_DeDdD+$H)ys7FKa`qS(K ze^A)e{{I2?3NqOQVDqqFws{~xDYXiumYPZh_Lr^1e#d^PSHp1RE)m5#hu>#Lc+(04%u&Y&`=T5)Z%u+~d*@xAcx8`7%_-h106V4!g2koQ?7IxtVCFw_7OYIfk{6|8>}nXbQJYbyhsI#H_SkuYJ1exTDt4Wvm7QG;j!B@QL(25d?!!^;q56z$%QK6*xo zGG;>gQA1U?4q|xS@G}bU45w)7>ncq9hS*7HOsRHMxw;COqcmCh37K;u@Inud5o~&( zteVL+eANs859@ysZ>C9ji5zIRM7-V49CV#@CQC;TIKV*0x{eKm>T`RTnD1nd9yb|3 zVffrfN)*_ONw*%?66e8c1BHp5}JwN5pOU7IpDQT1cK`qY literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/03r/others/03r08.fli b/Tests/images/fli_oob/03r/others/03r08.fli new file mode 100644 index 0000000000000000000000000000000000000000..698101443c52b6424f3d10cdf746310923fb7b06 GIT binary patch literal 784 zcmbV~KTZN+5XIlF7J`X^0%I@{qKyZz!I;>ry$7J=9?*IQ8WIn{0VwR&(hF!pFi{Kq zL(FQx{r350cR>gOy^bw=M-q4foVAV4*<(JX1G95s^)6qCg0oGduZ z3(jDm7SknMvlZ?!0-H)*a(COX&g;9InQCi#SgdxJsPcRTE}TP|96#d-pW2KI4Ia(6 zew6p4JJjwo{>)+B`2Ppk^EB2v0NaN?2?yE-GAK#QKpLqoDPw=xi0tdwo_ZAwN5Lih Rjt*ka!!~2D_CKXIj=x5EjFSKW literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/03r/others/03r09.fli b/Tests/images/fli_oob/03r/others/03r09.fli new file mode 100644 index 0000000000000000000000000000000000000000..12058480a4469be242fb7b4587538b1f55d10356 GIT binary patch literal 2210 zcmeHJI|{-;6dZ#^HloB=Rt;&(7CB6VD(x$M0; z5QhI`#Y#I&AnIE7`LOa@Lct3N74*S9JxOEpktp-hfiH5v^xqT%@6CqaEVrIy=MTOs P1;n85IJ@-65m531_d%RE literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/03r/others/03r10.fli b/Tests/images/fli_oob/03r/others/03r10.fli new file mode 100644 index 0000000000000000000000000000000000000000..448b0a812d75af0e15874c8a528ff22cb79839f9 GIT binary patch literal 61158 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 literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/03r/others/03r11.fli b/Tests/images/fli_oob/03r/others/03r11.fli new file mode 100644 index 0000000000000000000000000000000000000000..db1b5fe58705105bc70cebfb304e1c6c7a50e776 GIT binary patch literal 60120 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 literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/03r/reproducing b/Tests/images/fli_oob/03r/reproducing new file mode 100644 index 00000000000..145b8b074a2 --- /dev/null +++ b/Tests/images/fli_oob/03r/reproducing @@ -0,0 +1 @@ +im = Image.open(d); im.seek(0); im.getdata() diff --git a/Tests/images/fli_oob/04r/04r00.fli b/Tests/images/fli_oob/04r/04r00.fli new file mode 100644 index 0000000000000000000000000000000000000000..c4e416f3903ae979cab9cbf3a625d8dea7445ab8 GIT binary patch literal 551 zcmc(bK}y3w7=>R$u{Hsd2yv$^dIdLG=_203rH4>lILm@3kZuA!fO}mE?Xnk86x~Uw zsIAqK%=4d_XhFfPvzg4~&ByzGj?s(HeIP~;s}^Od-il##Y4BRVkRVu#{$ps zFTBJ9=1Hxg_DU%%Yc5bu$-Z425C7ObEJf59a#F7Y!Qge-o7xV)cmDoF7MoLqEp5bEd;D2Uyp zpaE-bO>#Uh;n6^G?4lk>a?iW>opWE{U1o#x=0y!?pg}l<&(+t-<2?r?hoC{N^+Ar| zXG1Q(bQ^hH;_5dx$ux_(gw$6?VxT`}J7WZ<;3RuT%9Xo*5cCa$1a;>F;ux65cH0cA zvk>r}EF&w%el47B!HRdCy*005_ER-1%U#ukA!1)_Dg%xbATdO5$6Mz}O+A2J$uhhS z(Ls||R#b4hR+7Au#^*`YDRN(DbI`Wi)OPjeOCUEA)xrU+z0u()=uQe6 zG}hL<_dD}Kq$j8Y$;&^P%s=ym0hhh24n9((L=*P8{WgER=L^Xx=+NnZku#Vu<@)O= zjdfL1zq3pFP;d?2fGj0XGvgpI2R%3spYYtcn`GI&12y|LIwkJ?tG zMD$qA=1VL5&z^BtK}TK-tM7{(r{Jwu$nW*P6docaaR#O7t<8 literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/04r/others/04r03.fli b/Tests/images/fli_oob/04r/others/04r03.fli new file mode 100644 index 0000000000000000000000000000000000000000..ab92f4b6a8358b806376851b6e37b097a68847b3 GIT binary patch literal 1008 zcmcIiy-LGS6#g28+6tNu7HmQL5H59biEp7>L3{*pFoSQ=rQid&>mmqsba7M=9STyg z1#5qk&+pz4(}=BIJdoU++;h(Tel9~?6fX0C3zvw)d&#{IpYHievJLvk7eC29oUqN6 zx4LWUDob&7d5a9fE|(EFAbXlar_WNz8W@1X@B;zY?wZwV(`R*p)wmPH2{7t9-#^U9 z`gf*DnH!TWfNtjWhh+M{LAHtrXTnTL=26HsGuOE<`jiUL?H=UGb- zY@xOGk{r(@{d;laK=NnipUasqOmS7YE&^qg31{J3;cN8#$aj(*Fh;TZO%CCw9j<>i z%URx3`F;D^*(H;-$2BBA$bsVYhpeTHzyutneI(p?XxHoQnDr@2z^3Xf4;R3==VuMw z%kJjpy}HkZJQo2lSD!_>QFghh@LNRtj5wpVj2^z1863Os3#6Bv_ zRLED}%-GuU$Q$+exr}fM-X|usoA0JPxeA=Yro?*O+z_?Et7ezhkDNs3*wcvurOD77 z$ysHiv47b(9m{NTFQ``t=>Px# literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/04r/others/04r05.fli b/Tests/images/fli_oob/04r/others/04r05.fli new file mode 100644 index 0000000000000000000000000000000000000000..b07ef6496aff8298c3365f8009267dc4697c0c60 GIT binary patch literal 785 zcmd^-!AiqG5QhJRKx+z31QBeZJ@gg4)c)on`fe<0l>V9+axqDkD?<8|j!N2|{OL#ix@FNaw zU)A(`n9j&r7xYlOAipF}x8y_z4`2=M^cFS8t2ByI#i+ta?$7NE{qqRy3%7mP#-Qt* z%s6tOOceQ6vRF?yJ>RiG=X~h+dZ=)E-fVqjO48JU<&nm7DI4+{8KnNN?61{Aa@G92 eE4jU3CS;PR6!CQH2rdeQpeMxMNnSu*fblP;`*0-y literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/04r/reproducing b/Tests/images/fli_oob/04r/reproducing new file mode 100644 index 00000000000..145b8b074a2 --- /dev/null +++ b/Tests/images/fli_oob/04r/reproducing @@ -0,0 +1 @@ +im = Image.open(d); im.seek(0); im.getdata() diff --git a/Tests/images/fli_oob/05r/05r00.fli b/Tests/images/fli_oob/05r/05r00.fli new file mode 100644 index 0000000000000000000000000000000000000000..dff5a01e804fc010316ebb2bf18080e38ee29790 GIT binary patch literal 863 zcmeHGu?@mN3_Ly*Bp~!O6e-vv)IS6Rz#eItAteK_0@YK}rlEljML;AV3ex}a;gyCB zK%8WsY)fa^vT3mzts_7}5-rprywv+0k0c8)MKpep)kfHYy;COfS)#EeyD$Re-RV$N zj4kJ&0c(4M;c%;yM5ojN`fVQ&OW;`sKGE?sXlUY;e0cSuP3TNGKl|fXH;{kZULv S$`AG>1=)o+2V)6YRRum5rofi~ literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/05r/others/05r02.fli b/Tests/images/fli_oob/05r/others/05r02.fli new file mode 100644 index 0000000000000000000000000000000000000000..cd6429884c4d3db82eb738f0a01c61a1dfdfcd43 GIT binary patch literal 3274 zcmeI#u?@m75CzbWp&$XF&`_jck5GG*ut!>ENXYX{c*6;FakPD zzSH@nv-G;7#df|6fd~=NAAJh0?eV~pWCdmj7f-T*vK7bYJi>2_#?~CcD3A{~hpJ(0 znSusv?Hz`*eUT(Z#^jAj{||@_@T!OYVc^rWOG`J&ml8!l1VlgtL_h>YKmd_a7pa(&UT2M>HW=t&=tgXjV z!G*BNOtPCDvZ2JRKi2^R29cS)(T>q-$t_7Abf6EeWC$UBw)d`qJjGZBY#|mPFDed2 zNKbi*=CP!;%qWn%utaUkCz!RKG0@aO|l9H~t}_W>1LayS40 literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/05r/others/05r04.fli b/Tests/images/fli_oob/05r/others/05r04.fli new file mode 100644 index 0000000000000000000000000000000000000000..0b547c7e2ec3d3941829b7cd7da5ec0933256715 GIT binary patch literal 1190 zcmd5+OAY}+5PgOPLu717EO3pno}+LMvvmeb2XG6PPGG}|h%t#zi0-FG6Bgpru~12O zbyfANex2$rYV=D37x3T_HwmV>=r9>`M$VUD2)Dc=_i*%**+tL8CB%D(O2^DVIUu)^ zht8f=%~pmAJm?J+i=(0M4@3GVi+;6A3c>2>npT`bPl!O_ndX^YX;T%cu!H X-0}VHH{a}e^VojdJgz))ZLoI+kZhuV literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/05r/others/05r05.fli b/Tests/images/fli_oob/05r/others/05r05.fli new file mode 100644 index 0000000000000000000000000000000000000000..0bf7752300e0a27f83cf2e8ab08000f0a46a60e0 GIT binary patch literal 11135 zcmeHN&2G~`5T3XZq^Sf!NI)r~d5bCsBo29$ig)Mfc#Cr2&1w41bbKGsp9tn1(PdTTFu59xS*znQkXp3UGv?ZvH^O`;aHK(p2Tw0Jz)-@#`9 z1Af~AkoNzuYhJFp}ZMdr#jsK8~8?UxIooySP z3tHm#kH`iHv_btdXQ4NX?ESpyebjm^`x-Jvc6Rf!S>7ufpaSt67Z^J{^w)5*prt(Ic zXRVH7|F$kg{?3?;`X%c;9wF`IhqOh4L4&UZl}fBs0mb@ic)40r%BM0myaG+$91815 zptX>^&6VHiv>^GfoeuKOem8H2Mfsz8QIY3y6;Fw|qi1t6Bb6JJ$oQ%esyCL%(&i*6 z>08J3?CDt~+CC8<%%D~OX@o4l3A9<{^Q(tDZQ*10oU6UH&{~6Zw+`>LVldMAxiadv z${s2QvK3Iid5+x|{Ah0b8!x{w;Yn)u5Bs`oIZg109$_f~oDT6*?)3Gygh}|u|d1@zA zLgI)_@Kgq|xy=)^eLZj)iYa2?h5ctviNFC+9hKs*TA%}!5@d#uDUZs`*(4kh(}O7D z61#lkVwvj@G@S0mzk(9uIYS+9R(z^-87D5;`-Ck%sfup5OKo6tlgJ}o&f~MIvvs~s zSmlq7H;+19KS6aq4ts}>!-mYf&Zk>@o<5&$y>@WsSROrDp6AJQ>tmutkYoJ?f-@7P literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/05r/others/05r06.fli b/Tests/images/fli_oob/05r/others/05r06.fli new file mode 100644 index 0000000000000000000000000000000000000000..c35b8e232f98ba1350c83351d472d3d51163ee6c GIT binary patch literal 619 zcmaKqzfQtX6vn?cCI}=_VkD78gAd^1f{ROi3U%wkBN&&y2M(;bxXWmQBQId0(an%Z zjfh3s&+oQWt)M4qa{k=&opXP;jB#GQECCK2A~W})_#8F{@gvD0=%ZA7BPX!qAy=Q; z4hGDZ7{vis5ZNHd(xE+JJq|rE0>k(f5!Y_|&1TXFk!{vo<-_M(S)!lf9mcJ5*_e z6p{_gD9el_d9_ZypLsY2uOqX-D7~Qc6e@87TV1}sY_5wsQNtn(=3x9mv^%$pR_1lP z=>r&g)*`+9oda#NlwM)itZVES#3Z*Ipb`5I;E~F%0B#%A)IPixw&bEn=u!1A93-f? GBjBI?)EM#r literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/05r/others/05r07.fli b/Tests/images/fli_oob/05r/others/05r07.fli new file mode 100644 index 0000000000000000000000000000000000000000..b99ce01b30715454f9e7edd461aecbc45b90bcf7 GIT binary patch literal 672 zcma)4Jx&5a6#jNKtFUTzEtF_OyakDc1;_CK*llBB;teQ009UY*(wf2;(E<(8#egK@ z&gYw--2tPCQ_Z~h=KGtW!d2R<0|^qMTC`g~&hm8EP@F=C4CoOZbbbzW1kLh_by*dxmQs26kFfoB35bh7gyGm5 z7${>|sB*{Y0+jL-aR>=sMe-fIlhwq_P=gcED>6B2H KDABlIO70taq350e literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/05r/reproducing b/Tests/images/fli_oob/05r/reproducing new file mode 100644 index 00000000000..145b8b074a2 --- /dev/null +++ b/Tests/images/fli_oob/05r/reproducing @@ -0,0 +1 @@ +im = Image.open(d); im.seek(0); im.getdata() diff --git a/Tests/images/fli_oob/06r/06r00.fli b/Tests/images/fli_oob/06r/06r00.fli new file mode 100644 index 0000000000000000000000000000000000000000..9189d6ed03f903b6cc0ad4a51e4c1f133cdedca2 GIT binary patch literal 1083 zcmd5(J5Iwu5PfS90rPVj#7Fo7RN%^@4ED=O zs*fXUP|G25&OEK!tZr;3YnhbLMI;sCq|*^M-^H>3KjB}_c?{$a29Av*TOa%KU)!DO mjs4=3UMhca%Khor@pxoEQm-W|RJ)bVH5axvCXl@(0h^yR@iP+u literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/06r/notes b/Tests/images/fli_oob/06r/notes new file mode 100644 index 00000000000..397ad4748a3 --- /dev/null +++ b/Tests/images/fli_oob/06r/notes @@ -0,0 +1 @@ +failure to check input buffer (`data`) boundaries in SS2 chunk diff --git a/Tests/images/fli_oob/06r/others/06r01.fli b/Tests/images/fli_oob/06r/others/06r01.fli new file mode 100644 index 0000000000000000000000000000000000000000..24a99dacc4fa006825ed6ff0566da14da33c47d4 GIT binary patch literal 1014 zcmbVKt4;$!6g{(TD3sSCAUr|^7E>72AVDG!1c9!`qq>gp1DFZ~2^P_RXiXC|f`o^G zq)F4#r2)EonAzD)*=0jETrrP(&b{}{$d>q)P}|L$3O~AU$BhAHd^Wt94gtI;@N^t#FBV*={Q}Vf;8osq{Sq z@m?DbChFlVCo-~@Ok};6-?B3Q!`sYQ6!|wRPZ}9)N$;94>(H=L%t|j0vO9lZyT385 rJFkDDiMC7^-w5C>xgYXk|0T-B_qcPpF_=EV;0I%xJPOX+QiAnwRv9l7 literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/06r/others/06r02.fli b/Tests/images/fli_oob/06r/others/06r02.fli new file mode 100644 index 0000000000000000000000000000000000000000..02067a32c106de3d765128685d67b1f4b39df7b1 GIT binary patch literal 1082 zcmdUtJx;?w5QX0wM8Nzx4dO>w6m&>P;L4)q23&!HD^TGMaRHi?v`E|{X(CZmAR%Y~ zMM8l<1jK&Ku5Gb4CJH4}?9T4Yy!kw9COE5KxPS+bFt!Hl-cCL7`jU4fJ8Ja^?!p`S z04M42;IZK$3xQD@Vw`k2j@SYDN+>#gE+;%CV_+ibA?94Gbrm)vh67B?b=r(L0Y19- zW2Uo80cwC!$4!pW={`~=A3+dM15Q!^wGFZl!ip~q3xE*7=cR=EsK?-Y z2G|TUz+PTS^?9fPV;O|eG|RkR)s0@sS|ppBnI}7hq}>*p-)vR_!{U{7<$}#1cqt{C z2Lr9!b@34`S~vgD-6%4j7mt;v5huK77292Y4pJxnZIC;b_K0rzi7U!%$~^4n&i7uG UCea~(<(4VV35L&aTV}z=7ng)K!TY*SCu}WSD_{BH1ATl=iL`C x+#M^l5|=BVc1;RPK4rKrU literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/06r/others/06r04.fli b/Tests/images/fli_oob/06r/others/06r04.fli new file mode 100644 index 0000000000000000000000000000000000000000..bff28ccfcea4b70c2109dc8640d1d054e07546c1 GIT binary patch literal 916 zcmdT@u}T9$6r5WVV=f?Pp`Z`~$qxvoNtNdO0&DRT{Do`N*;!l@unp`N2ttZ9fz%dh zw22`a4!j5r>HO$y!jIJG;puu z>=2OW=%DUe##kT=8#0Zb@of8WvG$RN!?h{@Ayo5C8=8|Jv*BEv)jjk|!MWJq_Yo=i fNK0`#7d3J2Dj>Q|=a_LKE{p7^Y0JK34KVx!z)$=- literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/06r/reproducing b/Tests/images/fli_oob/06r/reproducing new file mode 100644 index 00000000000..145b8b074a2 --- /dev/null +++ b/Tests/images/fli_oob/06r/reproducing @@ -0,0 +1 @@ +im = Image.open(d); im.seek(0); im.getdata() From 088ce4df981b70fbec140ee54417bcb49a7dffca Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Thu, 5 Mar 2020 10:46:27 +0000 Subject: [PATCH 08/11] comments --- src/libImaging/FliDecode.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libImaging/FliDecode.c b/src/libImaging/FliDecode.c index 98bc037681e..16ddf3a49f7 100644 --- a/src/libImaging/FliDecode.c +++ b/src/libImaging/FliDecode.c @@ -140,7 +140,7 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt break; case 12: /* FLI LC chunk (byte delta) */ - /* OOB Check ok, we have 10 bytes here */ + /* OOB Check ok, we have 4 bytes min here */ y = I16(data); ymax = y + I16(data+2); data += 4; for (; y < ymax && y < state->ysize; y++) { UINT8* out = (UINT8*) im->image[y]; @@ -180,19 +180,17 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt break; case 15: /* FLI BRUN chunk */ - /* data = ptr + 6 */ + /* OOB, ok, we've got 4 bytes min on entry */ for (y = 0; y < state->ysize; y++) { UINT8* out = (UINT8*) im->image[y]; data += 1; /* ignore packetcount byte */ for (x = 0; x < state->xsize; x += i) { - /* Out of Bounds Read issue, guaranteed to try to read 2 from data */ ERR_IF_DATA_OOB(2) if (data[0] & 0x80) { i = 256 - data[0]; if (x + i > state->xsize) { break; /* safety first */ } - /* Out of Bounds read issue */ ERR_IF_DATA_OOB(i+1) memcpy(out + x, data + 1, i); data += i + 1; From 5b490fc413dfab2d52de46a58905c25d9badb650 Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Tue, 10 Mar 2020 20:17:33 +0000 Subject: [PATCH 09/11] additional FLI check --- src/libImaging/FliDecode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libImaging/FliDecode.c b/src/libImaging/FliDecode.c index 16ddf3a49f7..108e1edf93a 100644 --- a/src/libImaging/FliDecode.c +++ b/src/libImaging/FliDecode.c @@ -144,6 +144,7 @@ ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt y = I16(data); ymax = y + I16(data+2); data += 4; for (; y < ymax && y < state->ysize; y++) { UINT8* out = (UINT8*) im->image[y]; + ERR_IF_DATA_OOB(1) int p, packets = *data++; for (p = x = 0; p < packets; p++, x += i) { ERR_IF_DATA_OOB(2) From 00c6dd72d9ed0124cec81040b4bab0979a200fe2 Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Tue, 10 Mar 2020 20:29:35 +0000 Subject: [PATCH 10/11] Tests for additional hits --- Tests/check_fli_oob.py | 4 ++++ Tests/images/fli_oob/patch0/000000 | Bin 0 -> 646 bytes Tests/images/fli_oob/patch0/000001 | Bin 0 -> 656 bytes Tests/images/fli_oob/patch0/000002 | Bin 0 -> 5486 bytes Tests/images/fli_oob/patch0/000003 | Bin 0 -> 6707 bytes 5 files changed, 4 insertions(+) create mode 100644 Tests/images/fli_oob/patch0/000000 create mode 100644 Tests/images/fli_oob/patch0/000001 create mode 100644 Tests/images/fli_oob/patch0/000002 create mode 100644 Tests/images/fli_oob/patch0/000003 diff --git a/Tests/check_fli_oob.py b/Tests/check_fli_oob.py index ca06c2cb825..8d83605aa48 100644 --- a/Tests/check_fli_oob.py +++ b/Tests/check_fli_oob.py @@ -17,6 +17,10 @@ 'images/fli_oob/05r/others/05r04.fli', 'images/fli_oob/05r/others/05r02.fli', 'images/fli_oob/05r/others/05r07.fli', + 'images/fli_oob/patch0/000000', + 'images/fli_oob/patch0/000001', + 'images/fli_oob/patch0/000002', + 'images/fli_oob/patch0/000003', ) diff --git a/Tests/images/fli_oob/patch0/000000 b/Tests/images/fli_oob/patch0/000000 new file mode 100644 index 0000000000000000000000000000000000000000..e074e4a76c0fa1581c97f5356c43c00d72930220 GIT binary patch literal 646 zcmeDF$FNv%Jr@ImKt02M1~4#SU~qZF`TpnK^Zy?={Qv)-;eP`Im)N)e|GzUZ{dn`A z{_cci{iOmk>VGT@VgB*#;L7fU`y! Ol!pM`K&RYzR1*OG^GhfI literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/patch0/000001 b/Tests/images/fli_oob/patch0/000001 new file mode 100644 index 0000000000000000000000000000000000000000..6cfd7f6478f4919d892f54cd23c0904d8debc5ad GIT binary patch literal 656 zcmeH@F$%&!5Jms478*s@Rw4ID?@_#msRYkp=>fcgm6o1B1g!)`0&0k4_Zu^83afyv zQ_RdC-e-n6I4lRN0Lmys_!uACw`{-TiQpBC5#UL-sNIDr7N+EK&yPaVx`a(w4f0XU zsZ$O)oq!h1+#Qy^Ef8&DMmai#pQW3a1FxhZiO&8A<2 NlUr+mf8^H>yaC7 literal 0 HcmV?d00001 diff --git a/Tests/images/fli_oob/patch0/000002 b/Tests/images/fli_oob/patch0/000002 new file mode 100644 index 0000000000000000000000000000000000000000..ff5a6b63b19e48eb790fa1dab71ae40d27aceafb GIT binary patch literal 5486 zcmds5Jx;?g6n=yXHEk7z2?U}N3r9dIQ;x#G!VMU^at1~Yzya7{`IxOfV6+J)Y>_%hwm2Ar8p)yuvfh{lfnI z&ZK^yu;%@b$B2$=V-Fk+5Eq1__Jc<*Uct-(ToT}*@eD9|n&M;)LyAW~8sQdTW$!ZK z9afE~x{xsz-b9IHrFDZ*myW9=;6_HImkhctuw+E{5UIt{>@o#|wMbuy=l#YtXs1R+;^R1v6$jepr)~1w1tku!L{~8|&wC?Q zoagn}sEt1JQtgnVX=CSYGPRW%RJBq<=wAYtMCT?bHw2Wd08#sZxl<7hJ@&C)Yq=m3 z1Z`b#nG1Xq5(XERr5U=Nwj2pDAJOAZcR#s~e-*H?A)4TA4?+ zs>Q|pqfm>ZrTp;DMTla1AAcif00<1h)VnfLPe;8 z7Fv-G4h~6N9RKpEsNzL3<9Tn!9(x=Iui$j$tO8(xh49<r1>t#2#P=Dyu`B z9718z!=>jF3j)(knV5cylW-2!v~N0WDOaQOnDdEUY17gR|cj|0a5 zR Date: Thu, 26 Mar 2020 21:39:58 +0200 Subject: [PATCH 11/11] Format with Black --- Tests/check_fli_oob.py | 89 ++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/Tests/check_fli_oob.py b/Tests/check_fli_oob.py index 8d83605aa48..739ad224e7e 100644 --- a/Tests/check_fli_oob.py +++ b/Tests/check_fli_oob.py @@ -2,56 +2,61 @@ from PIL import Image -repro_ss2 = ('images/fli_oob/06r/06r00.fli', - 'images/fli_oob/06r/others/06r01.fli', - 'images/fli_oob/06r/others/06r02.fli', - 'images/fli_oob/06r/others/06r03.fli', - 'images/fli_oob/06r/others/06r04.fli' +repro_ss2 = ( + "images/fli_oob/06r/06r00.fli", + "images/fli_oob/06r/others/06r01.fli", + "images/fli_oob/06r/others/06r02.fli", + "images/fli_oob/06r/others/06r03.fli", + "images/fli_oob/06r/others/06r04.fli", ) -repro_lc = ('images/fli_oob/05r/05r00.fli', - 'images/fli_oob/05r/others/05r03.fli', - 'images/fli_oob/05r/others/05r06.fli', - 'images/fli_oob/05r/others/05r05.fli', - 'images/fli_oob/05r/others/05r01.fli', - 'images/fli_oob/05r/others/05r04.fli', - 'images/fli_oob/05r/others/05r02.fli', - 'images/fli_oob/05r/others/05r07.fli', - 'images/fli_oob/patch0/000000', - 'images/fli_oob/patch0/000001', - 'images/fli_oob/patch0/000002', - 'images/fli_oob/patch0/000003', +repro_lc = ( + "images/fli_oob/05r/05r00.fli", + "images/fli_oob/05r/others/05r03.fli", + "images/fli_oob/05r/others/05r06.fli", + "images/fli_oob/05r/others/05r05.fli", + "images/fli_oob/05r/others/05r01.fli", + "images/fli_oob/05r/others/05r04.fli", + "images/fli_oob/05r/others/05r02.fli", + "images/fli_oob/05r/others/05r07.fli", + "images/fli_oob/patch0/000000", + "images/fli_oob/patch0/000001", + "images/fli_oob/patch0/000002", + "images/fli_oob/patch0/000003", ) -repro_advance = ('images/fli_oob/03r/03r00.fli', - 'images/fli_oob/03r/others/03r01.fli', - 'images/fli_oob/03r/others/03r09.fli', - 'images/fli_oob/03r/others/03r11.fli', - 'images/fli_oob/03r/others/03r05.fli', - 'images/fli_oob/03r/others/03r10.fli', - 'images/fli_oob/03r/others/03r06.fli', - 'images/fli_oob/03r/others/03r08.fli', - 'images/fli_oob/03r/others/03r03.fli', - 'images/fli_oob/03r/others/03r07.fli', - 'images/fli_oob/03r/others/03r02.fli', - 'images/fli_oob/03r/others/03r04.fli', +repro_advance = ( + "images/fli_oob/03r/03r00.fli", + "images/fli_oob/03r/others/03r01.fli", + "images/fli_oob/03r/others/03r09.fli", + "images/fli_oob/03r/others/03r11.fli", + "images/fli_oob/03r/others/03r05.fli", + "images/fli_oob/03r/others/03r10.fli", + "images/fli_oob/03r/others/03r06.fli", + "images/fli_oob/03r/others/03r08.fli", + "images/fli_oob/03r/others/03r03.fli", + "images/fli_oob/03r/others/03r07.fli", + "images/fli_oob/03r/others/03r02.fli", + "images/fli_oob/03r/others/03r04.fli", ) -repro_brun = ('images/fli_oob/04r/initial.fli', - 'images/fli_oob/04r/others/04r02.fli', - 'images/fli_oob/04r/others/04r05.fli', - 'images/fli_oob/04r/others/04r04.fli', - 'images/fli_oob/04r/others/04r03.fli', - 'images/fli_oob/04r/others/04r01.fli', - 'images/fli_oob/04r/04r00.fli', +repro_brun = ( + "images/fli_oob/04r/initial.fli", + "images/fli_oob/04r/others/04r02.fli", + "images/fli_oob/04r/others/04r05.fli", + "images/fli_oob/04r/others/04r04.fli", + "images/fli_oob/04r/others/04r03.fli", + "images/fli_oob/04r/others/04r01.fli", + "images/fli_oob/04r/04r00.fli", ) -repro_copy = ('images/fli_oob/02r/others/02r02.fli', - 'images/fli_oob/02r/others/02r04.fli', - 'images/fli_oob/02r/others/02r03.fli', - 'images/fli_oob/02r/others/02r01.fli', - 'images/fli_oob/02r/02r00.fli', +repro_copy = ( + "images/fli_oob/02r/others/02r02.fli", + "images/fli_oob/02r/others/02r04.fli", + "images/fli_oob/02r/others/02r03.fli", + "images/fli_oob/02r/others/02r01.fli", + "images/fli_oob/02r/02r00.fli", ) @@ -61,5 +66,3 @@ im.load() except Exception as msg: print(msg) - -