aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2003-08-30 22:17:59 +0000
committerTorbjörn Andersson2003-08-30 22:17:59 +0000
commitc54baa429b5ae607c89c86d7374ed6979897a11b (patch)
treee681780e2a91b18ad231423e5481792a2f1793fc
parentf00b48b4cf65380a0a8858e6dfad8ccdcaa95c14 (diff)
downloadscummvm-rg350-c54baa429b5ae607c89c86d7374ed6979897a11b.tar.gz
scummvm-rg350-c54baa429b5ae607c89c86d7374ed6979897a11b.tar.bz2
scummvm-rg350-c54baa429b5ae607c89c86d7374ed6979897a11b.zip
BS2 crashed because it passed a buffer of uneven length to the mixer. This
is the only place I can think of where this could have happened, so I've added a paranoid check to ensure the buffer length is even. Let's see how that works out... svn-id: r9933
-rw-r--r--sword2/driver/d_sound.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp
index 7010e692dc..0f4450881f 100644
--- a/sword2/driver/d_sound.cpp
+++ b/sword2/driver/d_sound.cpp
@@ -1925,6 +1925,10 @@ void Sword2Sound::UpdateCompSampleStreaming(void) {
if (soundHandleMusic[i] == 0) {
soundHandleMusic[i] = g_engine->_mixer->newStream(data16, bufferSizeMusic, 22050, SoundMixer::FLAG_16BITS, 100000);
} else {
+ // Paranoid check that seems to
+ // be necessary.
+ if (len & 1)
+ len--;
g_engine->_mixer->appendStream(soundHandleMusic[i], data16, len);
}