[Scummvm-cvs-logs] CVS: scummvm/queen logic.cpp,1.18,1.19

David Eriksson twogood at users.sourceforge.net
Mon Oct 6 01:25:04 CEST 2003


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv20395/queen

Modified Files:
	logic.cpp 
Log Message:
Check array bounds.


Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- logic.cpp	5 Oct 2003 16:07:07 -0000	1.18
+++ logic.cpp	6 Oct 2003 08:24:38 -0000	1.19
@@ -139,9 +139,9 @@
 		ptr += 2;
 	}
 	
-	_objMax = new int16[_numRooms + 1];
-	_areaMax = new int16[_numRooms + 1];
-	_area = new int16[_numRooms + 1][11][8];
+	_objMax   = new int16[_numRooms + 1];
+	_areaMax  = new int16[_numRooms + 1];
+	_area     = new int16[_numRooms + 1][11][8];
 
 	for (i = 1; i < (_numRooms + 1); i++) {
 		_objMax[i] = (int16)READ_BE_UINT16(ptr);
@@ -151,6 +151,8 @@
 		
 		for (j = 1; j < (_areaMax[i] + 1); j++)
 			for (k = 0; k < 8; k++) {
+				if (j > 11)
+					error("j (%i) too large, _areaMax[i] = %i", j, _areaMax[i]);
 				_area[i][j][k] = READ_BE_UINT16(ptr);
 				ptr += 2;
 			}





More information about the Scummvm-git-logs mailing list