aboutsummaryrefslogtreecommitdiff
path: root/sound/softsynth/mt32
diff options
context:
space:
mode:
authorDavid Turner2010-12-14 22:25:10 +0000
committerDavid Turner2010-12-14 22:25:10 +0000
commit3a5c8e6cfaeaa8e6a2ff421222418d2ea22721c1 (patch)
tree3e5eb9505b4a7d8f77f8270e817b1ce8d1587fb4 /sound/softsynth/mt32
parentd4ce60336166f2a18632e4bb3fe54d5bdff59651 (diff)
downloadscummvm-rg350-3a5c8e6cfaeaa8e6a2ff421222418d2ea22721c1.tar.gz
scummvm-rg350-3a5c8e6cfaeaa8e6a2ff421222418d2ea22721c1.tar.bz2
scummvm-rg350-3a5c8e6cfaeaa8e6a2ff421222418d2ea22721c1.zip
SOUND: Fix Un-initialised Memory Reads in MT-32 Emulator, reported by Valgrind.
svn-id: r54909
Diffstat (limited to 'sound/softsynth/mt32')
-rw-r--r--sound/softsynth/mt32/freeverb.cpp2
-rw-r--r--sound/softsynth/mt32/part.cpp1
-rw-r--r--sound/softsynth/mt32/synth.cpp3
3 files changed, 4 insertions, 2 deletions
diff --git a/sound/softsynth/mt32/freeverb.cpp b/sound/softsynth/mt32/freeverb.cpp
index 2a372fe19f..4ee6e20117 100644
--- a/sound/softsynth/mt32/freeverb.cpp
+++ b/sound/softsynth/mt32/freeverb.cpp
@@ -125,12 +125,12 @@ revmodel::revmodel() {
allpassR[2].setfeedback(0.5f);
allpassL[3].setfeedback(0.5f);
allpassR[3].setfeedback(0.5f);
+ setmode(initialmode);
setwet(initialwet);
setroomsize(initialroom);
setdry(initialdry);
setdamp(initialdamp);
setwidth(initialwidth);
- setmode(initialmode);
// Buffer will be full of rubbish - so we MUST mute them
mute();
diff --git a/sound/softsynth/mt32/part.cpp b/sound/softsynth/mt32/part.cpp
index b3d71bccca..eb087f7ea0 100644
--- a/sound/softsynth/mt32/part.cpp
+++ b/sound/softsynth/mt32/part.cpp
@@ -283,6 +283,7 @@ void Part::cacheTimbre(PatchCache cache[4], const TimbreParam *timbre) {
backupCacheToPartials(cache);
int partialCount = 0;
for (int t = 0; t < 4; t++) {
+ cache[t].PCMPartial = false;
if (((timbre->common.pmute >> t) & 0x1) == 1) {
cache[t].playPartial = true;
partialCount++;
diff --git a/sound/softsynth/mt32/synth.cpp b/sound/softsynth/mt32/synth.cpp
index 8cf2233654..55ca11ced7 100644
--- a/sound/softsynth/mt32/synth.cpp
+++ b/sound/softsynth/mt32/synth.cpp
@@ -337,7 +337,8 @@ bool Synth::initRhythmTimbre(int timbreNum, const Bit8u *mem, unsigned int memLe
memcpy(&timbre->common, mem, 14);
unsigned int memPos = 14;
char drumname[11];
- Common::strlcpy(drumname, timbre->common.name, 11);
+ memset(drumname, 0, 11);
+ memcpy(drumname, timbre->common.name, 10);
for (int t = 0; t < 4; t++) {
if (((timbre->common.pmute >> t) & 0x1) == 0x1) {
if (memPos + 58 >= memLen) {