Skip to content

Conversation

radarhere
Copy link
Member

In FliImagePlugin, self.__offset is initially set to 128, and may then be updated to a different value.

self.__offset = 128
if i16(s, 4) == 0xF100:
# prefix chunk; ignore it
self.__offset = self.__offset + i32(s)
self.fp.seek(self.__offset)

But before it is used again, and before the end of __init__(), it is set back to 128.

self.seek(0)

def seek(self, frame: int) -> None:
if not self._seek_check(frame):
return
if frame < self.__frame:
self._seek(0)

def _seek(self, frame: int) -> None:
if isinstance(self._fp, DeferredError):
raise self._fp.ex
if frame == 0:
self.__frame = -1
self._fp.seek(self.__rewind)
self.__offset = 128

So it seems simpler to just keep self.__offset at 128.

@hugovk hugovk merged commit 274a65b into python-pillow:main Oct 10, 2025
51 checks passed
@radarhere radarhere deleted the fli_offset branch October 10, 2025 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants