mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-30 02:33:07 +03:00
Merge pull request #4966 from radarhere/decompression
This commit is contained in:
commit
fee6bafead
|
@ -60,6 +60,10 @@ class TestDecompressionBomb:
|
||||||
with pytest.raises(Image.DecompressionBombError):
|
with pytest.raises(Image.DecompressionBombError):
|
||||||
Image.open("Tests/images/decompression_bomb.gif")
|
Image.open("Tests/images/decompression_bomb.gif")
|
||||||
|
|
||||||
|
def test_exception_bmp(self):
|
||||||
|
with pytest.raises(Image.DecompressionBombError):
|
||||||
|
Image.open("Tests/images/bmp/b/reallybig.bmp")
|
||||||
|
|
||||||
|
|
||||||
class TestDecompressionCrop:
|
class TestDecompressionCrop:
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -86,15 +86,11 @@ A new method :py:meth:`.ImageDraw.regular_polygon`, draws a regular polygon of `
|
||||||
For example ``draw.regular_polygon(((100, 100), 50), 5)``
|
For example ``draw.regular_polygon(((100, 100), 50), 5)``
|
||||||
draws a pentagon centered at the point ``(100, 100)`` with a polygon radius of ``50``.
|
draws a pentagon centered at the point ``(100, 100)`` with a polygon radius of ``50``.
|
||||||
|
|
||||||
Security
|
|
||||||
========
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
Other Changes
|
Other Changes
|
||||||
=============
|
=============
|
||||||
|
|
||||||
TODO
|
Error for large BMP files
|
||||||
^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
TODO
|
Previously, if a BMP file was too large, an ``OSError`` would be raised. Now,
|
||||||
|
``DecompressionBombError`` is used instead, as Pillow already uses for other formats.
|
||||||
|
|
|
@ -162,10 +162,6 @@ class BmpImageFile(ImageFile.ImageFile):
|
||||||
else (1 << file_info["bits"])
|
else (1 << file_info["bits"])
|
||||||
)
|
)
|
||||||
|
|
||||||
# ------------------------------- Check abnormal values for DOS attacks
|
|
||||||
if file_info["width"] * file_info["height"] > 2 ** 31:
|
|
||||||
raise OSError("Unsupported BMP Size: (%dx%d)" % self.size)
|
|
||||||
|
|
||||||
# ---------------------- Check bit depth for unusual unsupported values
|
# ---------------------- Check bit depth for unusual unsupported values
|
||||||
self.mode, raw_mode = BIT2MODE.get(file_info["bits"], (None, None))
|
self.mode, raw_mode = BIT2MODE.get(file_info["bits"], (None, None))
|
||||||
if self.mode is None:
|
if self.mode is None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user