Skip to content

Commit

Permalink
Tests for jp2 overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
wiredfool authored and hugovk committed Apr 1, 2020
1 parent cf6da6b commit 30443d3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Tests/check_jp2_overflow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python

# Reproductions/tests for OOB read errors in FliDecode.c

# When run in python, all of these images should fail for
# one reason or another, either as a buffer overrun,
# unrecognized datastream, or truncated image file.
# There shouldn't be any segfaults.
#
# if run like
# `valgrind --tool=memcheck python check_jp2_overflow.py 2>&1 | grep Decode.c`
# the output should be empty. There may be python issues
# in the valgrind especially if run in a debug python
# version.


from PIL import Image

repro = ('00r0_gray_l.jp2', '00r1_graya_la.jp2'
)

for path in repro:
im = Image.open(path)
try:
im.load()
except Exception as msg:
print(msg)


Binary file added Tests/images/00r0_gray_l.jp2
Binary file not shown.
Binary file added Tests/images/00r1_graya_la.jp2
Binary file not shown.

0 comments on commit 30443d3

Please sign in to comment.