[Scummvm-cvs-logs] CVS: scummvm/scumm resource.cpp,1.201,1.202 saveload.cpp,1.152,1.153

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Tue Apr 20 00:11:02 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23458

Modified Files:
	resource.cpp saveload.cpp 
Log Message:
Increased _numNewNames from 50 to 100 to prevent overflow in MI2 endgame.
This should fix bug #936323. (There are still some game versions that use
50, but that can be fixed later, if the need arises.)


Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.201
retrieving revision 1.202
diff -u -d -r1.201 -r1.202
--- resource.cpp	17 Apr 2004 16:29:02 -0000	1.201
+++ resource.cpp	20 Apr 2004 07:10:11 -0000	1.202
@@ -2111,7 +2111,8 @@
 		_numLocalObjects = _fileHandle.readUint16LE();   // 200
 		_numArray = 50;
 		_numVerbs = 100;
-		_numNewNames = 50;
+		// Used to be 50, which wasn't enough for MI2. See bug #936323.
+		_numNewNames = 100;
 		_objectRoomTable = NULL;
 
 		_fileHandle.readUint16LE();                      // 50

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -d -r1.152 -r1.153
--- saveload.cpp	5 Apr 2004 23:54:55 -0000	1.152
+++ saveload.cpp	20 Apr 2004 07:10:13 -0000	1.153
@@ -823,7 +823,13 @@
 					_inventory[idx] = ser->loadUint16();
 				}
 				if (type == rtObjectName && ser->getVersion() >= VER(25)) {
-					_newNames[idx] = ser->loadUint16();
+					// Paranoia: We increased the possible number of new names
+					// for MI2 to fix bug #936323. The savegame format didn't
+					// change, but at least during the transition period there
+					// is a slight chance that we try to load more names than
+					// we have allocated space for. If so, discard them.
+					if (idx < _numNewNames)
+						_newNames[idx] = ser->loadUint16();
 				}
 			}
 		}





More information about the Scummvm-git-logs mailing list