[Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.77,1.78

Pawel Kolodziejski aquadran at users.sourceforge.net
Sat Jan 25 12:02:16 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv32767

Modified Files:
	sound.cpp 
Log Message:
added assert for voice samples

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- sound.cpp	25 Jan 2003 18:41:32 -0000	1.77
+++ sound.cpp	25 Jan 2003 20:01:23 -0000	1.78
@@ -1161,7 +1161,7 @@
 		return -1;
 	}
 
-	int32 rate = 22050, channels;
+	int32 rate = 22050, channels, output_size = 0;
 	int32 tag, size = -1, bits = 0;
 
 	if (_scumm->_gameId == GID_CMI) {
@@ -1169,17 +1169,20 @@
 		strcpy(name, sound);
 		strcat(name, ".IMX");
 		ptr = (byte *)malloc(1000000);
-		if (_scumm->_bundle->decompressVoiceSampleByName(name, ptr) == 0) {
+		output_size = _scumm->_bundle->decompressVoiceSampleByName(name, ptr);
+		if (output_size == 0) {
 			delete ptr;
 			return -1;
 		}
 	} else {
 		ptr = (byte *)malloc(1000000);
-		if (_scumm->_bundle->decompressVoiceSampleByName(sound, ptr) == 0) {
+		output_size = _scumm->_bundle->decompressVoiceSampleByName(sound, ptr);
+		if (output_size == 0) {
 			delete ptr;
 			return -1;
 		}
 	}
+	assert(output_size <= 1000000);
 
 	tag = READ_BE_UINT32(ptr); ptr+=4;
 	if (tag != MKID_BE('iMUS')) {





More information about the Scummvm-git-logs mailing list