[Scummvm-tracker] [ScummVM :: Bugs] #17287: COMMON: GZipReadStream::seek() behavior on invalid resources created by ScummVM

ScummVM :: Bugs trac at scummvm.org
Mon Oct 5 08:46:27 UTC 2026


#17287: COMMON: GZipReadStream::seek() behavior on invalid resources created by
ScummVM
----------------------+---------------------
Reporter:  dwatteau   |       Owner:  (none)
    Type:  defect     |      Status:  new
Priority:  normal     |   Component:  Common
 Version:             |  Resolution:
Keywords:  gzip,zlib  |        Game:
----------------------+---------------------
Comment (by dwatteau):

 Also: FWIW, after letting `Claude:claude-opus-5-5` review the previous
 proposal, it also suggested this change:

 `common/compression/zlib.cpp`:
 {{{
                 byte tmpBuf[1024];
                 while (!err() && offset > 0) {
 -                       offset -= read(tmpBuf, MIN((int64)sizeof(tmpBuf),
 offset));
 +                       uint32 bytesRead = read(tmpBuf,
 MIN((int64)sizeof(tmpBuf), offset));
 +                       // Stop if the stream ends before reaching newPos
 (e.g. seeking past
 +                       // the end), as err() stays false on Z_STREAM_END
 and we'd loop forever
 +                       if (bytesRead == 0)
 +                               break;
 +                       offset -= bytesRead;
                 }

                 _eos = false;
 }}}

 I'll just let someone more competent on this subject than me decide
 whether we want this as well :)
-- 
Ticket URL: <https://bugs.scummvm.org/ticket/17287#comment:1>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list