aboutsummaryrefslogtreecommitdiff
path: root/engines/made
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2015-07-19 20:25:29 +0200
committerWillem Jan Palenstijn2015-07-19 20:27:19 +0200
commit0fbf90d14c531a9c0ff5490f6e81eeb3008e7cb6 (patch)
tree256d408923043070a48ec7d0ef51e42c601518d9 /engines/made
parent1a4f477d61704f85a235228f9f2d12077b369930 (diff)
downloadscummvm-rg350-0fbf90d14c531a9c0ff5490f6e81eeb3008e7cb6.tar.gz
scummvm-rg350-0fbf90d14c531a9c0ff5490f6e81eeb3008e7cb6.tar.bz2
scummvm-rg350-0fbf90d14c531a9c0ff5490f6e81eeb3008e7cb6.zip
MADE: Fix overflow in audio interpolation
The interpolation code for deltaType > 0 read past the end of the workChunkSize-sized filled area of the buffer (which matches what MADE did, as far as I can tell). Avoid this by repeating the last value.
Diffstat (limited to 'engines/made')
-rw-r--r--engines/made/sound.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/engines/made/sound.cpp b/engines/made/sound.cpp
index cf602a92bf..ad49031e7b 100644
--- a/engines/made/sound.cpp
+++ b/engines/made/sound.cpp
@@ -242,6 +242,11 @@ void decompressSound(byte *source, byte *dest, uint16 chunkSize, uint16 chunkCou
}
if (deltaType > 0) {
+ // NB: The original did not add this extra value at the end (as far
+ // as I can tell), and so technically read past the filled part of
+ // soundBuffer.
+ soundBuffer[workChunkSize] = soundBuffer[workChunkSize - 1];
+
if (deltaType == 1) {
for (i = 0; i < chunkSize - 1; i += 2) {
l = i / 2;