mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Added GIF decompression bomb check
This commit is contained in:
parent
8f35234f3a
commit
c9f1b35e98
BIN
Tests/images/decompression_bomb_extents.gif
Normal file
BIN
Tests/images/decompression_bomb_extents.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 368 B |
|
@ -61,6 +61,11 @@ class TestDecompressionBomb:
|
||||||
with Image.open("Tests/images/decompression_bomb.gif"):
|
with Image.open("Tests/images/decompression_bomb.gif"):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def test_exception_gif_extents(self):
|
||||||
|
with Image.open("Tests/images/decompression_bomb_extents.gif") as im:
|
||||||
|
with pytest.raises(Image.DecompressionBombError):
|
||||||
|
im.seek(1)
|
||||||
|
|
||||||
def test_exception_bmp(self):
|
def test_exception_bmp(self):
|
||||||
with pytest.raises(Image.DecompressionBombError):
|
with pytest.raises(Image.DecompressionBombError):
|
||||||
with Image.open("Tests/images/bmp/b/reallybig.bmp"):
|
with Image.open("Tests/images/bmp/b/reallybig.bmp"):
|
||||||
|
|
|
@ -265,6 +265,7 @@ class GifImageFile(ImageFile.ImageFile):
|
||||||
x1, y1 = x0 + i16(s, 4), y0 + i16(s, 6)
|
x1, y1 = x0 + i16(s, 4), y0 + i16(s, 6)
|
||||||
if (x1 > self.size[0] or y1 > self.size[1]) and update_image:
|
if (x1 > self.size[0] or y1 > self.size[1]) and update_image:
|
||||||
self._size = max(x1, self.size[0]), max(y1, self.size[1])
|
self._size = max(x1, self.size[0]), max(y1, self.size[1])
|
||||||
|
Image._decompression_bomb_check(self._size)
|
||||||
frame_dispose_extent = x0, y0, x1, y1
|
frame_dispose_extent = x0, y0, x1, y1
|
||||||
flags = s[8]
|
flags = s[8]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user