Mention MAX_TEXT_CHUNK limit in PNG error message by radarhere · Pull Request #8391 · python-pillow/Pillow

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.