-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from helper import PillowTestCase, unittest | ||
|
||
from PIL import Image | ||
|
||
class TestMap(PillowTestCase): | ||
def test_overflow(self): | ||
# There is the potential to overflow comparisons in map.c | ||
# if there are > SIZE_MAX bytes in the image or if | ||
# the file encodes an offset that makes | ||
# (offset + size(bytes)) > SIZE_MAX | ||
|
||
# Note that this image triggers the decompression bomb warning: | ||
max_pixels = Image.MAX_IMAGE_PIXELS | ||
Image.MAX_IMAGE_PIXELS = None | ||
|
||
# This image hits the offset test. | ||
im = Image.open('Tests/images/l2rgb_read.bmp') | ||
with self.assertRaises((ValueError, MemoryError)): | ||
im.load() | ||
|
||
Image.MAX_IMAGE_PIXELS = max_pixels | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters