aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-08-05 13:53:02 -0500
committerColin Snover2017-09-03 20:58:08 -0500
commitcc3088c5294ae9cc2e3eff995baa0fc70a61c704 (patch)
tree1772b83f9b4b47d36125913feb88b72afb1d14da
parent439a026844d826761338aee31a2d0db177890e54 (diff)
downloadscummvm-rg350-cc3088c5294ae9cc2e3eff995baa0fc70a61c704.tar.gz
scummvm-rg350-cc3088c5294ae9cc2e3eff995baa0fc70a61c704.tar.bz2
scummvm-rg350-cc3088c5294ae9cc2e3eff995baa0fc70a61c704.zip
SCI32: Make audio resource size mismatch non-fatal
Lighthouse audio.225 in RESSCI.002 (US English 1.0C) triggers this condition; the audio resource says its data is one byte larger than the recorded size in the volume. In this case, just use the smaller of the two values for the size, to avoid overreads.
-rw-r--r--engines/sci/resource.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 9cca933d7a..ee0f38934d 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -2256,9 +2256,9 @@ int Resource::decompress(ResVersion volVersion, Common::SeekableReadStream *file
const uint32 audioSize = READ_LE_UINT32(ptr + 9);
const uint32 calculatedTotalSize = audioSize + headerSize + kResourceHeaderSize;
if (calculatedTotalSize != _size) {
- error("Unexpected audio file size: the size of %s in %s is %d, but the volume says it should be %d", _id.toString().c_str(), _source->getLocationName().c_str(), calculatedTotalSize, _size);
+ warning("Unexpected audio file size: the size of %s in %s is %d, but the volume says it should be %d", _id.toString().c_str(), _source->getLocationName().c_str(), calculatedTotalSize, _size);
}
- _size = headerSize + audioSize;
+ _size = MIN(_size - kResourceHeaderSize, headerSize + audioSize);
}
}