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
Hi, I am recently fuzzing this library and found the test case which raises OverflowError.
What did you do?
fromPILimportImageimportio# assumes the current directory is the root of this repository.withopen('Tests/images/16bit.cropped.j2k', 'rb') asf:
data=bytearray(f.read())
# Change the main header of codestreamdata[8:12] =b"\xff\x00\x00\x00"# xsizdata[12:16] =b"\x00\x00\x00\x00"# ysizdata[16:20] =b"\x00\x00\x00\x00"# xosizdata[20:24] =b"\x00\x00\x00\x01"# yosiz# OverflowError is raisedwithImage.open(io.BytesIO(data)) asimg:
img.load()
What did you expect to happen?
Maybe ValueError is better.
What actually happened?
Traceback (most recent call last):
File "issue4.py", line 17, in <module>
img.load()
File "/usr/local/lib/python3.8/site-packages/PIL/Jpeg2KImagePlugin.py", line 278, in load
return ImageFile.ImageFile.load(self)
File "/usr/local/lib/python3.8/site-packages/PIL/ImageFile.py", line 201, in load
self.load_prepare()
File "/usr/local/lib/python3.8/site-packages/PIL/ImageFile.py", line 271, in load_prepare
self.im = Image.core.new(self.mode, self.size)
OverflowError: signed integer is greater than maximum
The size of ImageFile is (4278190080, -1). The first element of size is too large for PyArg_ParseTuple. Also, the test case passes through the bomb check because the second element is negative.
What are your OS, Python and Pillow versions?
OS: Debian GNU/Linux 11 (bullseye)
Python: 3.8.13
Pillow: 9.1.0
The text was updated successfully, but these errors were encountered:
After thinking this through, I've updated #6269 - it now prevents zero or negative height. That should resolve this, changing the error to UnidentifiedImageError.
Hi, I am recently fuzzing this library and found the test case which raises OverflowError.
What did you do?
What did you expect to happen?
Maybe ValueError is better.
What actually happened?
The size of ImageFile is
(4278190080, -1)
. The first element of size is too large forPyArg_ParseTuple
. Also, the test case passes through the bomb check because the second element is negative.What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: