Skip to content

Commit 30443d3

Browse files
wiredfoolhugovk
authored andcommitted
Tests for jp2 overflow
1 parent cf6da6b commit 30443d3

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

Tests/check_jp2_overflow.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env python
2+
3+
# Reproductions/tests for OOB read errors in FliDecode.c
4+
5+
# When run in python, all of these images should fail for
6+
# one reason or another, either as a buffer overrun,
7+
# unrecognized datastream, or truncated image file.
8+
# There shouldn't be any segfaults.
9+
#
10+
# if run like
11+
# `valgrind --tool=memcheck python check_jp2_overflow.py 2>&1 | grep Decode.c`
12+
# the output should be empty. There may be python issues
13+
# in the valgrind especially if run in a debug python
14+
# version.
15+
16+
17+
from PIL import Image
18+
19+
repro = ('00r0_gray_l.jp2', '00r1_graya_la.jp2'
20+
)
21+
22+
for path in repro:
23+
im = Image.open(path)
24+
try:
25+
im.load()
26+
except Exception as msg:
27+
print(msg)
28+
29+

Tests/images/00r0_gray_l.jp2

614 Bytes
Binary file not shown.

Tests/images/00r1_graya_la.jp2

335 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)