From e73b5ff4cd0c2ba4587c49bf310bb1421b47e725 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 3 Sep 2025 19:35:01 +1000 Subject: [PATCH 1/2] Do not unnecessarily update __offset --- src/PIL/FliImagePlugin.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/PIL/FliImagePlugin.py b/src/PIL/FliImagePlugin.py index ccb8a5953..679a9edd9 100644 --- a/src/PIL/FliImagePlugin.py +++ b/src/PIL/FliImagePlugin.py @@ -77,8 +77,7 @@ class FliImageFile(ImageFile.ImageFile): if i16(s, 4) == 0xF100: # prefix chunk; ignore it - self.__offset = self.__offset + i32(s) - self.fp.seek(self.__offset) + self.fp.seek(self.__offset + i32(s)) s = self.fp.read(16) if i16(s, 4) == 0xF1FA: From a52979785756bd2cd68aa3910945dce5ed96138f Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 5 Sep 2025 20:04:50 +1000 Subject: [PATCH 2/2] Assert fp is not None --- src/PIL/FliImagePlugin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/PIL/FliImagePlugin.py b/src/PIL/FliImagePlugin.py index 679a9edd9..b9cc8ad6c 100644 --- a/src/PIL/FliImagePlugin.py +++ b/src/PIL/FliImagePlugin.py @@ -48,6 +48,7 @@ class FliImageFile(ImageFile.ImageFile): def _open(self) -> None: # HEAD + assert self.fp is not None s = self.fp.read(128) if not (_accept(s) and s[20:22] == b"\x00\x00"): msg = "not an FLI/FLC file" @@ -110,6 +111,7 @@ class FliImageFile(ImageFile.ImageFile): # load palette i = 0 + assert self.fp is not None for e in range(i16(self.fp.read(2))): s = self.fp.read(2) i = i + s[0]