Pillow
Pillow copied to clipboard
Fixed reading PNG iCCP compression method
Resolves #7817
https://github.com/python-pillow/Pillow/blob/b8722f3431d4bd6196226810288443034f53e81f/src/PIL/PngImagePlugin.py#L388-L396
Pillow searches for b"\0", as the null separator at the end of the profile name.
Then it incorrectly uses the null separator as the compression method, when the compression method is the next byte.
The test image is a version of icc_profile_none.png, hex-edited to trigger the following error.
https://github.com/python-pillow/Pillow/blob/b8722f3431d4bd6196226810288443034f53e81f/src/PIL/PngImagePlugin.py#L397-L399