[Scummvm-cvs-logs] SF.net SVN: scummvm: [31933] scummvm/trunk/engines/kyra/staticres.cpp

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Wed May 7 23:04:06 CEST 2008


Revision: 31933
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31933&view=rev
Author:   athrxx
Date:     2008-05-07 14:04:06 -0700 (Wed, 07 May 2008)

Log Message:
-----------
Fix invalid memory access bug in the library sequence (original static data seems to be bugged here)

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/staticres.cpp

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2008-05-07 17:57:19 UTC (rev 31932)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2008-05-07 21:04:06 UTC (rev 31933)
@@ -728,6 +728,11 @@
 		if (ctrlOffs) {
 			int num_c = *(filePtr + ctrlOffs);
 			const uint16 *in_c = (uint16*) (filePtr + ctrlOffs + 1);
+			// safety check for library sequence which is supposed to have
+			// one frame more than control entries (seems to be a bug in
+			// the original code). This caused invalid memory access .
+			if (tmp_n[i].endFrame > num_c)
+				tmp_n[i].endFrame = num_c;
 			FrameControl *tmp_f = new FrameControl[num_c];
 
 			for (int ii = 0; ii < num_c; ii++) {


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