mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-28 02:46:18 +03:00
Moved flags check into _accept
This commit is contained in:
parent
efb9d503a7
commit
83b9e66133
|
@ -26,7 +26,11 @@ from ._binary import o8
|
||||||
|
|
||||||
|
|
||||||
def _accept(prefix):
|
def _accept(prefix):
|
||||||
return len(prefix) >= 6 and i16(prefix, 4) in [0xAF11, 0xAF12]
|
return (
|
||||||
|
len(prefix) >= 6
|
||||||
|
and i16(prefix, 4) in [0xAF11, 0xAF12]
|
||||||
|
and i16(prefix, 14) in [0, 3] # flags
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -44,11 +48,7 @@ class FliImageFile(ImageFile.ImageFile):
|
||||||
|
|
||||||
# HEAD
|
# HEAD
|
||||||
s = self.fp.read(128)
|
s = self.fp.read(128)
|
||||||
if not (
|
if not (_accept(s) and s[20:22] == b"\x00\x00"):
|
||||||
_accept(s)
|
|
||||||
and i16(s, 14) in [0, 3] # flags
|
|
||||||
and s[20:22] == b"\x00\x00" # reserved
|
|
||||||
):
|
|
||||||
raise SyntaxError("not an FLI/FLC file")
|
raise SyntaxError("not an FLI/FLC file")
|
||||||
|
|
||||||
# frames
|
# frames
|
||||||
|
|
Loading…
Reference in New Issue
Block a user