Skip to content

Mention MAX_TEXT_CHUNK limit in PNG error message#8391

Merged
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:png_decompress
Sep 18, 2024
Merged

Mention MAX_TEXT_CHUNK limit in PNG error message#8391
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:png_decompress

Conversation

@radarhere
Copy link
Copy Markdown
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
@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