[Scummvm-cvs-logs] SF.net SVN: scummvm:[47662] scummvm/trunk/engines/sci/sound/drivers/midi. cpp
waltervn at users.sourceforge.net
waltervn at users.sourceforge.net
Fri Jan 29 02:09:43 CET 2010
Revision: 47662
http://scummvm.svn.sourceforge.net/scummvm/?rev=47662&view=rev
Author: waltervn
Date: 2010-01-29 01:09:41 +0000 (Fri, 29 Jan 2010)
Log Message:
-----------
SCI: Fix out-of-bounds error in MT-32 patch reading in GM mode.
Modified Paths:
--------------
scummvm/trunk/engines/sci/sound/drivers/midi.cpp
Modified: scummvm/trunk/engines/sci/sound/drivers/midi.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/drivers/midi.cpp 2010-01-29 00:03:10 UTC (rev 47661)
+++ scummvm/trunk/engines/sci/sound/drivers/midi.cpp 2010-01-29 01:09:41 UTC (rev 47662)
@@ -659,10 +659,15 @@
debugCN(kDebugLevelSound, "%s -> ", Mt32PresetTimbreMaps[number].name);
break;
case 2:
- strncpy(name, (const char *)data + 0x1ec + number * 0xf6, 10);
- name[10] = 0;
- _patchMap[i] = lookupGmInstrument(name);
- debugCN(kDebugLevelSound, "%s -> ", name);
+ if (number < memtimbres) {
+ strncpy(name, (const char *)data + 0x1ec + number * 0xf6, 10);
+ name[10] = 0;
+ _patchMap[i] = lookupGmInstrument(name);
+ debugCN(kDebugLevelSound, "%s -> ", name);
+ } else {
+ _patchMap[i] = 0xff;
+ debugCN(kDebugLevelSound, "[Invalid] -> ");
+ }
break;
case 3:
_patchMap[i] = getGmInstrument(Mt32RhythmTimbreMaps[number]);
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