[Scummvm-cvs-logs] SF.net SVN: scummvm:[53575] scummvm/trunk/engines/scumm/smush/codec47.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Oct 18 21:03:25 CEST 2010


Revision: 53575
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53575&view=rev
Author:   fingolfin
Date:     2010-10-18 19:03:24 +0000 (Mon, 18 Oct 2010)

Log Message:
-----------
SCUMM: Fix out of bound access (discovered by Code Analysis in MS VS2010; thanks to aquadran for helping verify the fix)

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/smush/codec47.cpp

Modified: scummvm/trunk/engines/scumm/smush/codec47.cpp
===================================================================
--- scummvm/trunk/engines/scumm/smush/codec47.cpp	2010-10-18 18:56:40 UTC (rev 53574)
+++ scummvm/trunk/engines/scumm/smush/codec47.cpp	2010-10-18 19:03:24 UTC (rev 53575)
@@ -301,9 +301,11 @@
 	int32 a, c, d;
 	int16 tmp;
 
-	for (int l = 0; l < 512; l += 2) {
+	for (int l = 0; l < ARRAYSIZE(codec47_table); l += 2) {
 		_table[l / 2] = (int16)(codec47_table[l + 1] * width + codec47_table[l]);
 	}
+	// Note: _table[255] is never inited; but since only the first 0xF8
+	// entries of it are used anyway, this doesn't matter.
 
 	a = 0;
 	c = 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