diff options
author | Torbjörn Andersson | 2015-06-12 00:17:24 +0200 |
---|---|---|
committer | Torbjörn Andersson | 2015-06-12 00:17:24 +0200 |
commit | 8d62faf6193d3b2abe88a57062585b6f30330e9c (patch) | |
tree | e80020ed749cc9420c5ba3ebe56c4f3894e6f80b | |
parent | 5df022d75b94aff0c5e0c623669222a1d539b0cf (diff) | |
download | scummvm-rg350-8d62faf6193d3b2abe88a57062585b6f30330e9c.tar.gz scummvm-rg350-8d62faf6193d3b2abe88a57062585b6f30330e9c.tar.bz2 scummvm-rg350-8d62faf6193d3b2abe88a57062585b6f30330e9c.zip |
SHERLOCK: Fix two Valgrind warnings in the 3DO image decoder
The 3DO Serrated Scalpel intro now runs without any Valgrind
warnings, up to the point where it should be showing the credits.
-rw-r--r-- | engines/sherlock/image_file.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/engines/sherlock/image_file.cpp b/engines/sherlock/image_file.cpp index 56e0e082d1..3e11b09773 100644 --- a/engines/sherlock/image_file.cpp +++ b/engines/sherlock/image_file.cpp @@ -384,14 +384,14 @@ void ImageFile3DO::load3DOCelFile(Common::SeekableReadStream &stream) { chunkTag = stream.readUint32BE(); chunkSize = stream.readUint32BE(); + if (stream.eos() || stream.err()) + break; + if (chunkSize < 8) error("load3DOCelFile: Invalid chunk size"); uint32 dataSize = chunkSize - 8; - if (stream.eos() || stream.err()) - break; - switch (chunkTag) { case MKTAG('A', 'N', 'I', 'M'): // animation header @@ -636,7 +636,10 @@ inline uint16 ImageFile3DO::celGetBits(const byte *&dataPtr, byte bitCount, byte // Go to next byte dataPtr++; - currentByte = *dataPtr; dataBitsLeft = 8; + dataBitsLeft = 8; + if (resultBitsLeft) { + currentByte = *dataPtr; + } } } return result; |