aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-07-10 14:59:11 -0400
committerPaul Gilbert2016-07-15 19:27:42 -0400
commit62f2763bf794dfb711fd48e32d7c2162bdb5aed8 (patch)
treef53507762931d52db991f56c21d8e6749062dc28
parentfd954a8e0b41370ae68f3b409295676de207313d (diff)
downloadscummvm-rg350-62f2763bf794dfb711fd48e32d7c2162bdb5aed8.tar.gz
scummvm-rg350-62f2763bf794dfb711fd48e32d7c2162bdb5aed8.tar.bz2
scummvm-rg350-62f2763bf794dfb711fd48e32d7c2162bdb5aed8.zip
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
-rw-r--r--video/avi_decoder.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp
index 52a55f600c..8f1bec4388 100644
--- a/video/avi_decoder.cpp
+++ b/video/avi_decoder.cpp
@@ -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) {