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

Do not open images with zero or negative height #6269

Merged
merged 1 commit into from May 4, 2022

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented May 4, 2022

Resolves #6268

Pillow doesn't currently open images with zero or negative width.

Pillow/src/PIL/ImageFile.py

Lines 126 to 127 in 9d988da

if not self.mode or self.size[0] <= 0:
raise SyntaxError("not identified by this driver")

This PR also prevents opening images with zero or negative height.

@radarhere radarhere added the JPEG label May 4, 2022
@radarhere radarhere changed the title Do not allow negative height in JPEG2000 images Do not load images with zero or negative height May 4, 2022
@radarhere radarhere changed the title Do not load images with zero or negative height Do not open images with zero or negative height May 4, 2022
@hugovk hugovk added the automerge Automatically merge PRs that are ready label May 4, 2022
@hugovk
Copy link
Member

hugovk commented May 4, 2022

Failing Tests/test_imagetk.py::test_bitmapimage on macOS/3.7 is unrelated.

@hugovk hugovk merged commit 3aef70c into python-pillow:main May 4, 2022
@hugovk hugovk removed the automerge Automatically merge PRs that are ready label May 4, 2022
@radarhere radarhere deleted the jpeg2k branch May 4, 2022 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[JPEG 2000] OverflowError is raised when the size is too large
2 participants