[Scummvm-cvs-logs] CVS: scummvm/scumm script_v6.cpp,1.112,1.113

Max Horn fingolfin at users.sourceforge.net
Wed May 14 13:15:03 CEST 2003


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

Modified Files:
	script_v6.cpp 
Log Message:
additional readArray protection (might cause regression in FT, but then we should fix FT!)

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- script_v6.cpp	14 May 2003 10:14:05 -0000	1.112
+++ script_v6.cpp	14 May 2003 20:14:03 -0000	1.113
@@ -393,7 +393,7 @@
 int Scumm::readArray(int array, int idx, int base) {
 	ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array));
 
-	if (ah == NULL) {
+	if (ah == NULL || ah->data == NULL) {
 		error("readArray: invalid array %d (%d)", array, readVar(array));
 	}
 
@@ -401,7 +401,10 @@
 
 	// FIXME: comment this for the time being as it was causing ft to crash
 	// in the minefeild
-	//assert(base >= 0 && base < ah->dim1_size * ah->dim2_size);
+	// FIX THE FIXME: fixing an assert by commenting out is bad. It's evil.
+	// It's wrong. Find the proper cause, or at least, silently return
+	// from the function, but don't just go on overwriting memory!
+	assert(base >= 0 && base < ah->dim1_size * ah->dim2_size);
 
 	if (ah->type == 4) {
 		return ah->data[base];





More information about the Scummvm-git-logs mailing list