Skip to content

Commit a2e2939

Browse files
authored
Check all reserved bytes in FLI header (#9183)
2 parents 5a5c51c + 72c067a commit a2e2939

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.

src/PIL/FliImagePlugin.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ class FliImageFile(ImageFile.ImageFile):
4949
def _open(self) -> None:
5050
# HEAD
5151
s = self.fp.read(128)
52-
if not (_accept(s) and s[20:22] == b"\x00\x00"):
52+
if not (
53+
_accept(s)
54+
and s[20:22] == b"\x00" * 2
55+
and s[42:80] == b"\x00" * 38
56+
and s[88:] == b"\x00" * 40
57+
):
5358
msg = "not an FLI/FLC file"
5459
raise SyntaxError(msg)
5560

0 commit comments

Comments
 (0)