[Scummvm-devel] eof & err
Johannes Schickel
lordhoto at scummvm.org
Sun Jul 12 21:18:17 CEST 2009
Willem Jan Palenstijn wrote:
> On Sun, Jul 12, 2009 at 04:45:44PM +0000, Willem Jan Palenstijn wrote:
>
>> That code is _before_ reading, though, so that should be ok.
>>
>
> Correction: kyra does a couple of reads of length 0.
>
>
Well those don't come from inside KYRA though:
#0 StdioStream::read (this=0xe4e870, ptr=0x7fffffffce5f, len=0) at
../git/backends/fs/stdiostream.cpp:134
#1 0x0000000000592797 in Common::SubReadStream::read (this=0xe4e890,
dataPtr=0x7fffffffce5f, dataSize=0) at ../git/common/stream.cpp:184
#2 0x00000000004eb14c in Common::IFFParser::IFFChunkNav::read
(this=0x7fffffffcf10, dataPtr=0x7fffffffce5f, dataSize=0)
at ../git/common/iff_container.h:215
#3 0x0000000000592797 in Common::SubReadStream::read
(this=0x7fffffffce80, dataPtr=0x7fffffffce5f, dataSize=0)
at ../git/common/stream.cpp:184
#4 0x00000000004da33d in Common::ReadStream::readByte
(this=0x7fffffffce80) at ../git/common/stream.h:192
#5 0x00000000004eb42d in Common::IFFParser::parse (this=0x7fffffffcef0,
callback=...) at ../git/common/iff_container.h:294
#6 0x00007ffff36d6246 in Kyra::EMCInterpreter::load (this=0xd7ed10,
filename=0x7ffff37b9a6a "_STARTUP.EMC", scriptData=0xd64c38,
opcodes=0xd63530) at ../git/engines/kyra/script.cpp:119
Judging by the code of "Common::SubReadStream::read" it seems like
IFFParser tries to read past the end of a SubReadStream.
The specific bugged code doing an read of 0 bytes is:
// eats up all the remaining data in the chunk
while (!stream.eos()) {
stream.readByte();
}
in common/iff_parser.h l293. Since SubReadStream relies on the parent
streams eos, in this case a StdioStream, either StdioStream::eos is
bugged or there's a little bug in SubReadStream.
// Johannes
More information about the Scummvm-devel
mailing list