VIDEO: Respect RIFF filesize field when decoding AVI files

Starship Titanic in particular needs this, since some of the videos
have extra junk at the end of the file, such as ycursors.avi,
and parsing fails if we don't respect the filesize field
This commit is contained in:
Paul Gilbert 2016-07-10 14:59:11 -04:00
parent fd954a8e0b
commit 62f2763bf7

View File

@ -296,7 +296,7 @@ bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) {
return false;
}
/* uint32 fileSize = */ stream->readUint32LE();
uint32 fileSize = stream->readUint32LE();
uint32 riffType = stream->readUint32BE();
if (riffType != ID_AVI) {
@ -307,7 +307,7 @@ bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) {
_fileStream = stream;
// Go through all chunks in the file
while (parseNextChunk())
while (_fileStream->pos() < fileSize && parseNextChunk())
;
if (!_decodedHeader) {