From 5676c862bea286104841b794325492a4e9155dee Mon Sep 17 00:00:00 2001 From: Hugh Ranalli Date: Thu, 29 Nov 2018 14:13:27 -0500 Subject: [PATCH] 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. --- src/PIL/ImageFile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PIL/ImageFile.py b/src/PIL/ImageFile.py index 915557a57..b6f1b8fb0 100644 --- a/src/PIL/ImageFile.py +++ b/src/PIL/ImageFile.py @@ -221,13 +221,13 @@ class ImageFile(Image.Image): s = read(self.decodermaxblock) except (IndexError, struct.error): # truncated png/gif - if LOAD_TRUNCATED_IMAGES: + if ImageFile.LOAD_TRUNCATED_IMAGES: break else: raise IOError("image file is truncated") if not s: # truncated jpeg - if LOAD_TRUNCATED_IMAGES: + if ImageFile.LOAD_TRUNCATED_IMAGES: break else: self.tile = []