[Scummvm-cvs-logs] SF.net SVN: scummvm: [24754] scummvm/trunk/engines/scumm/boxes.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Nov 20 21:40:27 CET 2006


Revision: 24754
          http://svn.sourceforge.net/scummvm/?rev=24754&view=rev
Author:   fingolfin
Date:     2006-11-20 12:40:27 -0800 (Mon, 20 Nov 2006)

Log Message:
-----------
Fix for bug #1599113: SCUMM: Failed assertion in getBoxCoordinates()

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/boxes.cpp

Modified: scummvm/trunk/engines/scumm/boxes.cpp
===================================================================
--- scummvm/trunk/engines/scumm/boxes.cpp	2006-11-20 20:27:30 UTC (rev 24753)
+++ scummvm/trunk/engines/scumm/boxes.cpp	2006-11-20 20:40:27 UTC (rev 24754)
@@ -510,8 +510,15 @@
 	return (-1);
 }
 
-bool ScummEngine::checkXYInBoxBounds(int b, int x, int y) {
-	BoxCoords box = getBoxCoordinates(b);
+bool ScummEngine::checkXYInBoxBounds(int boxnum, int x, int y) {
+	// Since this method is called by many other methods that take params
+	// from e.g. script opcodes, but do not validate the boxnum, we
+	// make a check here to filter out invalid boxes.
+	// See also bug #1599113.
+	if (boxnum < 0 || boxnum == Actor::kInvalidBox)
+		return false;
+
+	BoxCoords box = getBoxCoordinates(boxnum);
 	const Common::Point p(x, y);
 
 	// Quick check: If the x (resp. y) coordinate of the point is


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