[Scummvm-cvs-logs] SF.net SVN: scummvm:[33688] scummvm/trunk/engines/cine/gfx.cpp

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Thu Aug 7 21:46:07 CEST 2008


Revision: 33688
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33688&view=rev
Author:   buddha_
Date:     2008-08-07 19:46:06 +0000 (Thu, 07 Aug 2008)

Log Message:
-----------
Added precautionary tests to background scrolling function in Operation Stealth to avoid possible memory corruptions.

Modified Paths:
--------------
    scummvm/trunk/engines/cine/gfx.cpp

Modified: scummvm/trunk/engines/cine/gfx.cpp
===================================================================
--- scummvm/trunk/engines/cine/gfx.cpp	2008-08-07 19:31:12 UTC (rev 33687)
+++ scummvm/trunk/engines/cine/gfx.cpp	2008-08-07 19:46:06 UTC (rev 33688)
@@ -1041,8 +1041,12 @@
 
 		assert(scroll);
 
-		memcpy(_backBuffer, main + mainShift, mainSize);
-		memcpy(_backBuffer + mainSize, scroll, mainShift);
+		if (mainSize > 0) { // Just a precaution
+			memcpy(_backBuffer, main + mainShift, mainSize);
+		}
+		if (mainShift > 0) { // Just a precaution
+			memcpy(_backBuffer + mainSize, scroll, mainShift);
+		}
 	}
 }
 


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