[Scummvm-cvs-logs] SF.net SVN: scummvm:[41803] scummvm/trunk/engines/gob/sound/adlib.cpp

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Tue Jun 23 10:51:55 CEST 2009


Revision: 41803
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41803&view=rev
Author:   drmccoy
Date:     2009-06-23 08:51:55 +0000 (Tue, 23 Jun 2009)

Log Message:
-----------
Changing the TBR FIXME into a warning in setVoice()

Modified Paths:
--------------
    scummvm/trunk/engines/gob/sound/adlib.cpp

Modified: scummvm/trunk/engines/gob/sound/adlib.cpp
===================================================================
--- scummvm/trunk/engines/gob/sound/adlib.cpp	2009-06-23 07:44:35 UTC (rev 41802)
+++ scummvm/trunk/engines/gob/sound/adlib.cpp	2009-06-23 08:51:55 UTC (rev 41803)
@@ -549,12 +549,7 @@
 
 	_timbresSize = stream.size();
 
-	// FIXME: _timbresSize is smaller than setVoice() expects!
-	uint32 rSize = MAX<uint32>(_timbresSize, 810);
-
-	_timbres = new byte[rSize];
-	memset(_timbres, 0, rSize);
-
+	_timbres = new byte[_timbresSize];
 	stream.read(_timbres, _timbresSize);
 
 	reset();
@@ -754,7 +749,12 @@
 	for (int i = 0; i < 2; i++) {
 		timbrePtr = _timbres + _tbrStart + instr * 0x38 + i * 0x1A;
 		for (int j = 0; j < 27; j++) {
-			strct[j] = READ_LE_UINT16(timbrePtr);
+			if (timbrePtr >= (_timbres + _timbresSize)) {
+				warning("Instrument %d out of range (%d, %d)", instr,
+						(uint32) (timbrePtr - _timbres), _timbresSize);
+				strct[j] = 0;
+			} else
+				strct[j] = READ_LE_UINT16(timbrePtr);
 			timbrePtr += 2;
 		}
 		channel = _operators[voice] + i * 3;


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