Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pillow fails to load truncated images with LOAD_TRUNCATED_IMAGES #1366

Merged

Conversation

homm
Copy link
Member

@homm homm commented Jul 31, 2015

This fixes regression from #1121 (version 2.8.1).
Starting from #1121 all functions in _binary.py start raising struct.error instead of IndexError. This leads to two side effects with truncated PNG images: wrong exception type when LOAD_TRUNCATED_IMAGES = False and truncated files are not loaded when LOAD_TRUNCATED_IMAGES = True.

@@ -204,11 +206,11 @@ def load(self):
while True:
try:
s = read(self.decodermaxblock)
except IndexError as ie: # truncated png/gif
except (IndexError, struct.error) as ie: # truncated png/gif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ie is unused, since you've replaced it with a string below.

@homm homm changed the title Regression: Pillow fails to load truncated images with LOAD_TRUNCATED_IMAGES Pillow fails to load truncated images with LOAD_TRUNCATED_IMAGES Jul 31, 2015
@radarhere
Copy link
Member

I'm reasonably certain that notifications aren't sent out for this, so just letting you know there is now a merge conflict for this PR. The resolution is a simple one.

@homm homm force-pushed the fix-truncated-regression-from-master branch from a2f121d to 1d236f0 Compare September 8, 2015 14:44
@homm
Copy link
Member Author

homm commented Sep 8, 2015

Rebased.

wiredfool added a commit that referenced this pull request Sep 10, 2015
…m-master

Pillow fails to load truncated images with LOAD_TRUNCATED_IMAGES
@wiredfool wiredfool merged commit 1b40b6f into python-pillow:master Sep 10, 2015
@homm homm deleted the fix-truncated-regression-from-master branch April 28, 2016 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants