[Scummvm-cvs-logs] SF.net SVN: scummvm:[54373] scummvm/trunk/engines/sci/engine/klists.cpp

lskovlun at users.sourceforge.net lskovlun at users.sourceforge.net
Fri Nov 19 13:49:46 CET 2010


Revision: 54373
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54373&view=rev
Author:   lskovlun
Date:     2010-11-19 12:49:46 +0000 (Fri, 19 Nov 2010)

Log Message:
-----------
Implement a couple of NULL checks in kArray

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/klists.cpp

Modified: scummvm/trunk/engines/sci/engine/klists.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/klists.cpp	2010-11-19 12:49:33 UTC (rev 54372)
+++ scummvm/trunk/engines/sci/engine/klists.cpp	2010-11-19 12:49:46 UTC (rev 54373)
@@ -688,6 +688,11 @@
 		return argv[1];
 	}
 	case 6: { // Cpy
+		if (argv[1].isNull() || argv[3].isNull()) {
+			warning("kArray(Cpy): Request to copy from or to a null pointer");
+			return NULL_REG;
+		}
+	  
 #if 0
 		if (s->_segMan->getSegmentObj(argv[1].segment)->getType() != SEG_TYPE_ARRAY ||
 			s->_segMan->getSegmentObj(argv[3].segment)->getType() != SEG_TYPE_ARRAY) {
@@ -722,6 +727,11 @@
 		warning("kArray(Cmp) called");
 		return s->r_acc;
 	case 8: { // Dup
+		if (argv[1].isNull()) {
+			warning("kArray(Dup): Request to duplicate a null pointer");
+			return NULL_REG;
+		}
+
 		SegmentType sourceType = s->_segMan->getSegmentObj(argv[1].segment)->getType();
 		if (sourceType == SEG_TYPE_SCRIPT) {
 			// A technique used in later SCI2.1 and SCI3 games: the contents of a script


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