Skip to content

Commit 83b9e66

Browse files
committed
Moved flags check into _accept
1 parent efb9d50 commit 83b9e66

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/PIL/FliImagePlugin.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626

2727

2828
def _accept(prefix):
29-
return len(prefix) >= 6 and i16(prefix, 4) in [0xAF11, 0xAF12]
29+
return (
30+
len(prefix) >= 6
31+
and i16(prefix, 4) in [0xAF11, 0xAF12]
32+
and i16(prefix, 14) in [0, 3] # flags
33+
)
3034

3135

3236
##
@@ -44,11 +48,7 @@ def _open(self):
4448

4549
# HEAD
4650
s = self.fp.read(128)
47-
if not (
48-
_accept(s)
49-
and i16(s, 14) in [0, 3] # flags
50-
and s[20:22] == b"\x00\x00" # reserved
51-
):
51+
if not (_accept(s) and s[20:22] == b"\x00\x00"):
5252
raise SyntaxError("not an FLI/FLC file")
5353

5454
# frames

0 commit comments

Comments
 (0)