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

Handle PCX images with an odd stride #5214

Merged
merged 1 commit into from Mar 7, 2021
Merged

Conversation

radarhere
Copy link
Member

Resolves #5203

The PCX specification states that 'BytesPerLine' 'MUST be an EVEN number.'
The two images that are failing in the issue list the BytesPerLine as 371 and 409. So they are malformed.

This may not be uncommon, since it has been noted in an earlier issue

Unfortunately, both Gimp and ImageMagick both write images with odd strides

The images started to fail after #5174 (ping @wiredfool) abandoned the image's reported stride in favour of calculating it ourselves. This PR relaxes that slightly, by allowing the reported stride to tell us whether this is a well-formed image with an even stride, or a malformed image with an odd stride.

If the thinking is that we should just reject the malformed images, then this can be closed.

@hugovk hugovk merged commit f9b830f into python-pillow:master Mar 7, 2021
@radarhere radarhere deleted the pcx branch March 7, 2021 21:01
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.

Some PCX files trigger OSError since 8.1.0
2 participants