Removed OSError in favour of DecompressionBombError

This commit is contained in:
Andrew Murray 2020-10-12 19:32:48 +11:00
parent 15c339470d
commit 518b783c64
2 changed files with 4 additions and 4 deletions

View File

@ -60,6 +60,10 @@ class TestDecompressionBomb:
with pytest.raises(Image.DecompressionBombError):
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:
@classmethod

View File

@ -162,10 +162,6 @@ class BmpImageFile(ImageFile.ImageFile):
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
self.mode, raw_mode = BIT2MODE.get(file_info["bits"], (None, None))
if self.mode is None: