Skip to content

Raise the same error if a truncated image is loaded a second time#3965

Merged
hugovk merged 1 commit intopython-pillow:masterfrom
radarhere:truncated
Sep 20, 2019
Merged

Raise the same error if a truncated image is loaded a second time#3965
hugovk merged 1 commit intopython-pillow:masterfrom
radarhere:truncated

Conversation

@radarhere
Copy link
Copy Markdown
Member

@radarhere radarhere commented Jul 12, 2019

Resolves #3863, and see also #2977, two issues that find it strange that Pillow is inconsistent between the first load() of a truncated image, and the second.

After load() is called on a truncated image, an error is raised and there is a line - self.tile = []. This means that when load() is called a second time, it thinks there is nothing to do and does not return the same truncated error. This logic has been present since the fork.

Instead, this PR removes that line, causing the same error to be raised on subsequent loads. It also resets an internal variable of PngImagePlugin, to fix an error that was raised when changing the tests for this, also providing consistency by resetting the image to it's initial state.

@hugovk hugovk mentioned this pull request Jul 15, 2019
@hugovk hugovk merged commit 8e3c4e3 into python-pillow:master Sep 20, 2019
@radarhere radarhere deleted the truncated branch September 21, 2019 11:38
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.

Conversion of image to array fails

3 participants