[Scummvm-cvs-logs] SF.net SVN: scummvm: [29926] scummvm/trunk/engines/cruise/function.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Thu Dec 20 19:52:06 CET 2007


Revision: 29926
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29926&view=rev
Author:   eriktorbjorn
Date:     2007-12-20 10:52:05 -0800 (Thu, 20 Dec 2007)

Log Message:
-----------
Fixed compiler warning, and a potential (but very unlikely) out-of-bounds read.

Modified Paths:
--------------
    scummvm/trunk/engines/cruise/function.cpp

Modified: scummvm/trunk/engines/cruise/function.cpp
===================================================================
--- scummvm/trunk/engines/cruise/function.cpp	2007-12-20 18:21:27 UTC (rev 29925)
+++ scummvm/trunk/engines/cruise/function.cpp	2007-12-20 18:52:05 UTC (rev 29926)
@@ -1818,13 +1818,7 @@
 	if (opcode > 0x100)
 		return (-21);
 
-	if(opcode > sizeof(opcodeTablePtr) / sizeof(opcodeFunction)) {
-		printf("Unsupported opcode %d in opcode type 8\n", opcode);
-		pushVar(0);
-	}
-
-
-	if (opcodeTablePtr[opcode]) {
+	if (opcode < ARRAYSIZE(opcodeTablePtr) && opcodeTablePtr[opcode]) {
 	//	printf("Function: %d\n",opcode);
 		pushVar(opcodeTablePtr[opcode] ());
 		return (0);


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