FIX: fix PngImageFile.load_end

Ensure that the flow-control EOFError exceptions are properly handled.

closes #3527
This commit is contained in:
Thomas A Caswell 2019-01-02 10:46:51 -05:00
parent 41fba67fb0
commit 7436501a2a
No known key found for this signature in database
GPG Key ID: BCD928050D713D75

View File

@ -677,6 +677,11 @@ class PngImageFile(ImageFile.ImageFile):
self.png.call(cid, pos, length) self.png.call(cid, pos, length)
except UnicodeDecodeError: except UnicodeDecodeError:
break break
except EOFError:
# call dispatches out to chunk_* methods which
# mutate the internal state and then raise EOFError
# for a chunk that must be last.
break
self._text = self.png.im_text self._text = self.png.im_text
self.png.close() self.png.close()
self.png = None self.png = None