Fixed DOS with invalid BMP size entries

This commit is contained in:
wiredfool 2014-01-31 21:33:24 -08:00
parent 3ea93e5de5
commit 88d0e6080a

View File

@ -99,6 +99,10 @@ class BmpImageFile(ImageFile.ImageFile):
else:
raise IOError("Unsupported BMP header type (%d)" % len(s))
if (self.size[0]*self.size[1]) > 2**31:
# Prevent DOS for > 2gb images
raise IOError("Unsupported BMP Size: (%dx%d)" % self.size)
if not colors:
colors = 1 << bits