mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-11 17:56:18 +03:00
Handle IDAT chunks after image end
This commit is contained in:
parent
41fba67fb0
commit
ea2a0e4654
BIN
Tests/images/hopper_idat_after_image_end.png
Normal file
BIN
Tests/images/hopper_idat_after_image_end.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 59 KiB |
|
@ -585,6 +585,10 @@ class TestFilePng(PillowTestCase):
|
|||
self.assertIsInstance(im.text, dict)
|
||||
ImageFile.LOAD_TRUNCATED_IMAGES = False
|
||||
|
||||
# Raises an EOFError in load_end
|
||||
im = Image.open("Tests/images/hopper_idat_after_image_end.png")
|
||||
self.assertEqual(im.text, {'TXT': 'VALUE', 'ZIP': 'VALUE'})
|
||||
|
||||
@unittest.skipUnless(HAVE_WEBP and _webp.HAVE_WEBPANIM,
|
||||
"WebP support not installed with animation")
|
||||
def test_apng(self):
|
||||
|
|
|
@ -677,6 +677,8 @@ class PngImageFile(ImageFile.ImageFile):
|
|||
self.png.call(cid, pos, length)
|
||||
except UnicodeDecodeError:
|
||||
break
|
||||
except EOFError:
|
||||
ImageFile._safe_read(self.fp, length)
|
||||
self._text = self.png.im_text
|
||||
self.png.close()
|
||||
self.png = None
|
||||
|
|
Loading…
Reference in New Issue
Block a user