[Scummvm-cvs-logs] SF.net SVN: scummvm:[35446] scummvm/trunk/graphics/smk_player.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Dec 19 22:55:18 CET 2008


Revision: 35446
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35446&view=rev
Author:   thebluegr
Date:     2008-12-19 21:55:18 +0000 (Fri, 19 Dec 2008)

Log Message:
-----------
Hopefully fixed invalid buffer reads

Modified Paths:
--------------
    scummvm/trunk/graphics/smk_player.cpp

Modified: scummvm/trunk/graphics/smk_player.cpp
===================================================================
--- scummvm/trunk/graphics/smk_player.cpp	2008-12-19 21:22:26 UTC (rev 35445)
+++ scummvm/trunk/graphics/smk_player.cpp	2008-12-19 21:55:18 UTC (rev 35446)
@@ -762,7 +762,7 @@
 
 	int numBytes = 1 * (isStereo ? 2 : 1) * (is16Bits ? 2 : 1);
 
-	byte *unpackedBuffer = new byte[unpackedSize + numBytes];
+	byte *unpackedBuffer = new byte[unpackedSize];
 	byte *curPointer = unpackedBuffer;
 	uint32 curPos = 0;
 
@@ -783,7 +783,7 @@
 
 
 	// The bases are the first samples, too
-	for (int i = 0; i < (isStereo ? 2 : 1); i++, curPointer += (is16Bits ? 2 : 1)) {
+	for (int i = 0; i < (isStereo ? 2 : 1); i++, curPointer += (is16Bits ? 2 : 1), curPos += (is16Bits ? 2 : 1)) {
 		if (is16Bits)
 			WRITE_BE_UINT16(curPointer, bases[i]);
 		else
@@ -822,7 +822,7 @@
 	for (int k = 0; k < numBytes; k++)
 		delete audioTrees[k];
 
-	_audioStream->queueBuffer(unpackedBuffer, unpackedSize + numBytes);
+	_audioStream->queueBuffer(unpackedBuffer, unpackedSize);
 	// unpackedBuffer will be deleted by AppendableAudioStream
 }
 


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