diff options
author | Filippos Karapetis | 2016-10-07 12:29:14 +0300 |
---|---|---|
committer | Filippos Karapetis | 2016-10-07 12:29:14 +0300 |
commit | 8df9eb5b8fd5a88a1158f9a6253bd0b18fc52362 (patch) | |
tree | fc3aaa18539f4afcad9e2e61b4a03364d50a31b1 | |
parent | c3a4950c983235ce566e6fc96856b5848c4a38f5 (diff) | |
download | scummvm-rg350-8df9eb5b8fd5a88a1158f9a6253bd0b18fc52362.tar.gz scummvm-rg350-8df9eb5b8fd5a88a1158f9a6253bd0b18fc52362.tar.bz2 scummvm-rg350-8df9eb5b8fd5a88a1158f9a6253bd0b18fc52362.zip |
CHEWY: Fix undefined behavior
-rw-r--r-- | engines/chewy/resource.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/engines/chewy/resource.cpp b/engines/chewy/resource.cpp index c1164f193b..e112d98cdb 100644 --- a/engines/chewy/resource.cpp +++ b/engines/chewy/resource.cpp @@ -251,10 +251,11 @@ SoundChunk *SoundResource::getSound(uint num) { // Find the total length of the voice file do { blocksRemaining = _stream.readByte(); - blockSize = - _stream.readByte() + - (_stream.readByte() << 8) + - (_stream.readByte() << 16); + + byte b1 = _stream.readByte(); + byte b2 = _stream.readByte(); + byte b3 = _stream.readByte(); + blockSize = b1 + (b2 << 8) + (b3 << 16); totalLength += blockSize; _stream.skip(blockSize); @@ -269,10 +270,11 @@ SoundChunk *SoundResource::getSound(uint num) { do { blocksRemaining = _stream.readByte(); - blockSize = - _stream.readByte() + - (_stream.readByte() << 8) + - (_stream.readByte() << 16); + + byte b1 = _stream.readByte(); + byte b2 = _stream.readByte(); + byte b3 = _stream.readByte(); + blockSize = b1 + (b2 << 8) + (b3 << 16); _stream.read(ptr, blockSize); ptr += blockSize; |