[Scummvm-cvs-logs] SF.net SVN: scummvm:[54909] scummvm/trunk/sound/softsynth/mt32

tdhs at users.sourceforge.net tdhs at users.sourceforge.net
Tue Dec 14 23:25:10 CET 2010


Revision: 54909
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54909&view=rev
Author:   tdhs
Date:     2010-12-14 22:25:10 +0000 (Tue, 14 Dec 2010)

Log Message:
-----------
SOUND: Fix Un-initialised Memory Reads in MT-32 Emulator, reported by Valgrind.

Modified Paths:
--------------
    scummvm/trunk/sound/softsynth/mt32/freeverb.cpp
    scummvm/trunk/sound/softsynth/mt32/part.cpp
    scummvm/trunk/sound/softsynth/mt32/synth.cpp

Modified: scummvm/trunk/sound/softsynth/mt32/freeverb.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/mt32/freeverb.cpp	2010-12-14 22:20:42 UTC (rev 54908)
+++ scummvm/trunk/sound/softsynth/mt32/freeverb.cpp	2010-12-14 22:25:10 UTC (rev 54909)
@@ -125,12 +125,12 @@
 	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();

Modified: scummvm/trunk/sound/softsynth/mt32/part.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/mt32/part.cpp	2010-12-14 22:20:42 UTC (rev 54908)
+++ scummvm/trunk/sound/softsynth/mt32/part.cpp	2010-12-14 22:25:10 UTC (rev 54909)
@@ -283,6 +283,7 @@
 	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++;

Modified: scummvm/trunk/sound/softsynth/mt32/synth.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/mt32/synth.cpp	2010-12-14 22:20:42 UTC (rev 54908)
+++ scummvm/trunk/sound/softsynth/mt32/synth.cpp	2010-12-14 22:25:10 UTC (rev 54909)
@@ -337,7 +337,8 @@
 	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) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list