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

@radarhere radarhere commented Jan 20, 2021

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
50 checks passed
@radarhere radarhere deleted the pcx branch Mar 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants