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

Mention MAX_TEXT_CHUNK limit in PNG error message #8391

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

radarhere
Copy link
Member

Resolves #8363

plaintext = dobj.decompress(s, MAX_TEXT_CHUNK)
if dobj.unconsumed_tail:
msg = "Decompressed Data Too Large"
raise ValueError(msg)

This PR changes the error message to "Decompressed data too large for PngImagePlugin.MAX_TEXT_CHUNK".

This is more informative. If the user searches our docs for "PngImagePlugin.MAX_TEXT_CHUNK" they will find https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#png-opening

Individual compressed chunks are limited to a decompressed size of PngImagePlugin.MAX_TEXT_CHUNK, by default 1MB, to prevent decompression bombs.

@hugovk hugovk merged commit e80cada into python-pillow:main Sep 18, 2024
46 checks passed
@radarhere radarhere deleted the png_decompress branch September 18, 2024 12:33
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.

ValueError: Decompressed Data Too Large
2 participants