Skip to content

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