mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
Tests for tiff crashes
This commit is contained in:
parent
b8d4ce1a59
commit
6e7c0ced68
28
Tests/check_tiff_crashes.py
Normal file
28
Tests/check_tiff_crashes.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Reproductions/tests for crashes/read errors in TiffDecode.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_tiff_crashes.py 2>&1 | grep TiffDecode.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_read_strip = ('images/crash_1.tif',
|
||||
'images/crash_2.tif',
|
||||
)
|
||||
|
||||
for path in repro_read_strip:
|
||||
with Image.open(path) as im:
|
||||
try:
|
||||
im.load()
|
||||
except Exception as msg:
|
||||
print(msg)
|
BIN
Tests/images/crash_1.tif
Normal file
BIN
Tests/images/crash_1.tif
Normal file
Binary file not shown.
BIN
Tests/images/crash_2.tif
Normal file
BIN
Tests/images/crash_2.tif
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user