mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-25 22:54:46 +03:00
Qualify reference to LOAD_TRUNCATED_IMAGES
Setting ImageFile.LOAD_TRUNCATED_IMAGES = True had no effect in loading JPEG images with "extra" data after the end of image marker in a Zope application. Tracing the code showed that although ImageFile.LOAD_TRUNCATED_IMAGES was True, the unqualified reference in ImageFile.py to LOAD_TRUNCATED_IMAGES returned False, and so the load failed.
This commit is contained in:
parent
080bfd3ee1
commit
5676c862be
|
@ -221,13 +221,13 @@ class ImageFile(Image.Image):
|
||||||
s = read(self.decodermaxblock)
|
s = read(self.decodermaxblock)
|
||||||
except (IndexError, struct.error):
|
except (IndexError, struct.error):
|
||||||
# truncated png/gif
|
# truncated png/gif
|
||||||
if LOAD_TRUNCATED_IMAGES:
|
if ImageFile.LOAD_TRUNCATED_IMAGES:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
raise IOError("image file is truncated")
|
raise IOError("image file is truncated")
|
||||||
|
|
||||||
if not s: # truncated jpeg
|
if not s: # truncated jpeg
|
||||||
if LOAD_TRUNCATED_IMAGES:
|
if ImageFile.LOAD_TRUNCATED_IMAGES:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
self.tile = []
|
self.tile = []
|
||||||
|
|
Loading…
Reference in New Issue
Block a user