Skip to content

Commit 6fdbf54

Browse files
committed
Width and height are unsigned
1 parent d80cf0e commit 6fdbf54

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/PIL/GbrImagePlugin.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def _open(self) -> None:
5454
width = i32(self.fp.read(4))
5555
height = i32(self.fp.read(4))
5656
color_depth = i32(self.fp.read(4))
57-
if width <= 0 or height <= 0:
57+
if width == 0 or height == 0:
5858
msg = "not a GIMP brush"
5959
raise SyntaxError(msg)
6060
if color_depth not in (1, 4):
@@ -71,7 +71,7 @@ def _open(self) -> None:
7171
raise SyntaxError(msg)
7272
self.info["spacing"] = i32(self.fp.read(4))
7373

74-
comment = self.fp.read(comment_length)[:-1]
74+
self.info["comment"] = self.fp.read(comment_length)[:-1]
7575

7676
if color_depth == 1:
7777
self._mode = "L"
@@ -80,8 +80,6 @@ def _open(self) -> None:
8080

8181
self._size = width, height
8282

83-
self.info["comment"] = comment
84-
8583
# Image might not be small
8684
Image._decompression_bomb_check(self.size)
8785

0 commit comments

Comments
 (0)