Skip to content

Raise ValueError if PNG chunks are truncated#6253

Merged
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:png_chunk_length
May 6, 2022
Merged

Raise ValueError if PNG chunks are truncated#6253
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:png_chunk_length

Conversation

@radarhere
Copy link
Copy Markdown
Member

Resolves #6252

Some PNG chunks expect a certain amount of data.
If the chunk doesn't state that it is long enough to contain that data, then errors can occur, as reported in the issue.

Instead, this PR raises a ValueError. As with other operations in PngImagePlugin, ImageFile.LOAD_TRUNCATED_IMAGES = True can be used to silence these errors.

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.

[PNG] struct.error is raised when there is the broken IHDR chunk after the IDAT chunk

2 participants