mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-15 09:44:46 +03:00
Width and height are unsigned
This commit is contained in:
parent
d80cf0ee1b
commit
6fdbf54331
|
@ -54,7 +54,7 @@ class GbrImageFile(ImageFile.ImageFile):
|
||||||
width = i32(self.fp.read(4))
|
width = i32(self.fp.read(4))
|
||||||
height = i32(self.fp.read(4))
|
height = i32(self.fp.read(4))
|
||||||
color_depth = i32(self.fp.read(4))
|
color_depth = i32(self.fp.read(4))
|
||||||
if width <= 0 or height <= 0:
|
if width == 0 or height == 0:
|
||||||
msg = "not a GIMP brush"
|
msg = "not a GIMP brush"
|
||||||
raise SyntaxError(msg)
|
raise SyntaxError(msg)
|
||||||
if color_depth not in (1, 4):
|
if color_depth not in (1, 4):
|
||||||
|
@ -71,7 +71,7 @@ class GbrImageFile(ImageFile.ImageFile):
|
||||||
raise SyntaxError(msg)
|
raise SyntaxError(msg)
|
||||||
self.info["spacing"] = i32(self.fp.read(4))
|
self.info["spacing"] = i32(self.fp.read(4))
|
||||||
|
|
||||||
comment = self.fp.read(comment_length)[:-1]
|
self.info["comment"] = self.fp.read(comment_length)[:-1]
|
||||||
|
|
||||||
if color_depth == 1:
|
if color_depth == 1:
|
||||||
self._mode = "L"
|
self._mode = "L"
|
||||||
|
@ -80,8 +80,6 @@ class GbrImageFile(ImageFile.ImageFile):
|
||||||
|
|
||||||
self._size = width, height
|
self._size = width, height
|
||||||
|
|
||||||
self.info["comment"] = comment
|
|
||||||
|
|
||||||
# Image might not be small
|
# Image might not be small
|
||||||
Image._decompression_bomb_check(self.size)
|
Image._decompression_bomb_check(self.size)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user