mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 17:06:16 +03:00
Merge pull request #3532 from radarhere/png_load_end_idat
PNG: Handle IDAT chunks after image end
This commit is contained in:
commit
22b0f53eb9
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 |
|
@ -586,6 +586,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):
|
||||
|
|
|
@ -680,6 +680,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