[Scummvm-cvs-logs] CVS: scummvm/scumm script_v6.cpp,1.293.2.6,1.293.2.7

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Fri Mar 5 03:36:05 CET 2004


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

Modified Files:
      Tag: branch-0-6-0
	script_v6.cpp 
Log Message:
Added the same out-of-bounds checking to the "get pixel" kernel function
as on the trunk, minus the scary (and, above all, verbose) warning message.


Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.293.2.6
retrieving revision 1.293.2.7
diff -u -d -r1.293.2.6 -r1.293.2.7
--- script_v6.cpp	2 Mar 2004 12:19:33 -0000	1.293.2.6
+++ script_v6.cpp	5 Mar 2004 11:13:56 -0000	1.293.2.7
@@ -2703,11 +2703,14 @@
 		// the virtual mouse coordinates, because that's what used
 		// everywhere else in the script.
 
-		if (args[1] != -1 && args[2] != -1) {
+		{
 			VirtScreen *vs = &virtscr[0];
-			push(vs->screenPtr[args[1] + args[2] * vs->width]);
-		} else
-			push(0);
+			if (args[1] < 0 || args[1] >= vs->width || args[2] < 0 || args[2] >= vs->height) {
+				// FIXME: Until we know what to do in this case...
+				push(0);
+			} else
+				push(vs->screenPtr[args[1] + args[2] * vs->width]);
+		}
 		break;
 	case 115:
 		push(getSpecialBox(args[1], args[2]));





More information about the Scummvm-git-logs mailing list