From cc3088c5294ae9cc2e3eff995baa0fc70a61c704 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sat, 5 Aug 2017 13:53:02 -0500 Subject: 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. --- engines/sci/resource.cpp | 4 ++-- 1 file 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); } } -- cgit v1.2.3