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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Fri Oct 30 11:06:36 CET 2009


Revision: 45530
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45530&view=rev
Author:   m_kiewitz
Date:     2009-10-30 10:06:35 +0000 (Fri, 30 Oct 2009)

Log Message:
-----------
SCI: kStrAt / dont do call, when offset exceeds maxSize. fixes crash in kq5

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

Modified: scummvm/trunk/engines/sci/engine/kstring.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kstring.cpp	2009-10-30 09:51:00 UTC (rev 45529)
+++ scummvm/trunk/engines/sci/engine/kstring.cpp	2009-10-30 10:06:35 UTC (rev 45530)
@@ -309,8 +309,11 @@
 		newvalue = argv[2].toSint16();
 
 	if (dest_r.isRaw) {
-		// FIXME: in kq5 this here gets called with offset = 0xFFFF, we should implement maxSize check in here
-		//  i dont know the exact behaviour, so i dont know how to do this correctly
+		// in kq5 this here gets called with offset 0xFFFF
+		if ((int)offset > dest_r.maxSize) {
+			warning("kStrAt offset %X exceeds maxSize", offset);
+			return s->r_acc;
+		}
 		value = dest_r.raw[offset];
 		if (argc > 2) /* Request to modify this char */
 			dest_r.raw[offset] = newvalue;


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