Test showing failure opening image without supplied fix #3003 on 32bit systems

This commit is contained in:
paddywwoof 2019-08-04 17:07:14 +01:00
parent a780a51f9e
commit 5954bacc92
3 changed files with 6 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 KiB

View File

@ -633,6 +633,11 @@ class TestFileJpeg(PillowTestCase):
# Act / Assert # Act / Assert
self.assertEqual(im._getexif()[306], "2017:03:13 23:03:09") self.assertEqual(im._getexif()[306], "2017:03:13 23:03:09")
def test_bad_exif_overflow_32(self):
# This image has some corrupt exif offsets that unpack to values greater
# than ssize_t on 32 bit systems
im = Image.open('Tests/images/corrupt_exif.jpg')
def test_photoshop(self): def test_photoshop(self):
im = Image.open("Tests/images/photoshop-200dpi.jpg") im = Image.open("Tests/images/photoshop-200dpi.jpg")
self.assertEqual( self.assertEqual(

View File

@ -776,7 +776,7 @@ class ImageFileDirectory_v2(MutableMapping):
except OverflowError as e: except OverflowError as e:
if DEBUG: if DEBUG:
print( print(
"- offset value wrong. Possibly corrupt EXIF data. ", e "Offset too large. Possibly corrupt EXIF data. ", e
) )
continue # ignore corrupt EXIF data continue # ignore corrupt EXIF data
data = ImageFile._safe_read(fp, size) data = ImageFile._safe_read(fp, size)