[Scummvm-cvs-logs] SF.net SVN: scummvm:[53788] scummvm/trunk/engines/gob/map.h

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Mon Oct 25 05:37:24 CEST 2010


Revision: 53788
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53788&view=rev
Author:   drmccoy
Date:     2010-10-25 03:37:24 +0000 (Mon, 25 Oct 2010)

Log Message:
-----------
GOB: Add sanity checks to getPass()/setPass()

Modified Paths:
--------------
    scummvm/trunk/engines/gob/map.h

Modified: scummvm/trunk/engines/gob/map.h
===================================================================
--- scummvm/trunk/engines/gob/map.h	2010-10-25 03:37:00 UTC (rev 53787)
+++ scummvm/trunk/engines/gob/map.h	2010-10-25 03:37:24 UTC (rev 53788)
@@ -152,6 +152,9 @@
 		if (!_passMap)
 			return 0;
 
+		if ((x < 0) || (y < 0) || (x >= _mapWidth) || (y >= _mapHeight))
+			return 0;
+
 		return _passMap[y * _mapWidth + x];
 	}
 
@@ -159,6 +162,9 @@
 		if (!_passMap)
 			return;
 
+		if ((x < 0) || (y < 0) || (x >= _mapWidth) || (y >= _mapHeight))
+			return;
+
 		_passMap[y * _mapWidth + x] = pass;
 	}
 
@@ -184,6 +190,9 @@
 		if (!_passMap)
 			return 0;
 
+		if ((x < 0) || (y < 0) || (x >= _mapWidth) || (y >= _mapHeight))
+			return 0;
+
 		if (heightOff == -1)
 			heightOff = _passWidth;
 		return _passMap[y * heightOff + x];
@@ -193,6 +202,9 @@
 		if (!_passMap)
 			return;
 
+		if ((x < 0) || (y < 0) || (x >= _mapWidth) || (y >= _mapHeight))
+			return;
+
 		if (heightOff == -1)
 			heightOff = _passWidth;
 		_passMap[y * heightOff + x] = pass;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list