Check all reserved bytes in header

This commit is contained in:
Andrew Murray 2025-09-03 19:23:26 +10:00
parent 31eee6e5f7
commit 72c067af29
4 changed files with 6 additions and 1 deletions

View File

@ -49,7 +49,12 @@ class FliImageFile(ImageFile.ImageFile):
def _open(self) -> None:
# HEAD
s = self.fp.read(128)
if not (_accept(s) and s[20:22] == b"\x00\x00"):
if not (
_accept(s)
and s[20:22] == b"\x00" * 2
and s[42:80] == b"\x00" * 38
and s[88:] == b"\x00" * 40
):
msg = "not an FLI/FLC file"
raise SyntaxError(msg)