mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Do not read data until necessary
This commit is contained in:
parent
6b9b392ccc
commit
fbaaf3c19b
|
@ -43,9 +43,9 @@ class GbrImageFile(ImageFile.ImageFile):
|
||||||
|
|
||||||
def _open(self):
|
def _open(self):
|
||||||
header_size = i32(self.fp.read(4))
|
header_size = i32(self.fp.read(4))
|
||||||
version = i32(self.fp.read(4))
|
|
||||||
if header_size < 20:
|
if header_size < 20:
|
||||||
raise SyntaxError("not a GIMP brush")
|
raise SyntaxError("not a GIMP brush")
|
||||||
|
version = i32(self.fp.read(4))
|
||||||
if version not in (1, 2):
|
if version not in (1, 2):
|
||||||
raise SyntaxError(f"Unsupported GIMP brush version: {version}")
|
raise SyntaxError(f"Unsupported GIMP brush version: {version}")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user