You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect the images to be loaded as they were with previous (<8.1.0) pillow versions.
What actually happened?
Depending on the used file it fails to load with OSError: buffer overrun when reading image file or OSError: image file is truncated (0 bytes not processed). But not all images fail to load.
What are your OS, Python and Pillow versions?
OS: Any (tested on Ubuntu, MacOS and Windows)
Python: >3.5 (tested on 3.6, 3.7, 3.8)
Pillow: 8.1.0
This is a simple test case with images that used to load fine. One still works, the two others trigger the different OSError
Sorry for the delay, I had to check with the original author of the images.
You can use any of the images in your test suite and distribute them under the Pillow license.
The specification states that 'BytesPerLine' 'MUST be an EVEN number.'
The two images that are failing here list the BytesPerLine as 371 and 409. So technically, they are malformed.
I've created PR #5214 to float the idea of reading them anyway.
It has been pointed to me that the BytesPerLine issue was fixed in GIMP 2 years ago. So re exporting pcx files is enough to fix them.
Anyway, even if the idea of reading them anyway seems to look nice, it may be better to just detect odd BytesPerLine and error with a nice message, instead of failing later while reading the data.
Activity
radarhere commentedon Jan 11, 2021
Hi. Thanks for being detailed in your report. Are we able to add any of those images to our test suite, and distribute them under the Pillow license?
glx22 commentedon Jan 15, 2021
Sorry for the delay, I had to check with the original author of the images.
You can use any of the images in your test suite and distribute them under the Pillow license.
radarhere commentedon Jan 20, 2021
The specification states that 'BytesPerLine' 'MUST be an EVEN number.'
The two images that are failing here list the BytesPerLine as 371 and 409. So technically, they are malformed.
I've created PR #5214 to float the idea of reading them anyway.
glx22 commentedon Feb 6, 2021
It has been pointed to me that the
BytesPerLineissue was fixed in GIMP 2 years ago. So re exporting pcx files is enough to fix them.Anyway, even if the idea of reading them anyway seems to look nice, it may be better to just detect odd
BytesPerLineand error with a nice message, instead of failing later while reading the data.