[Scummvm-cvs-logs] SF.net SVN: scummvm:[46851] scummvm/trunk/engines/gob/sound/adlib.cpp

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Fri Jan 1 22:18:20 CET 2010


Revision: 46851
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46851&view=rev
Author:   strangerke
Date:     2010-01-01 21:18:19 +0000 (Fri, 01 Jan 2010)

Log Message:
-----------
Fix a buffer overflow, thanks to syke

Modified Paths:
--------------
    scummvm/trunk/engines/gob/sound/adlib.cpp

Modified: scummvm/trunk/engines/gob/sound/adlib.cpp
===================================================================
--- scummvm/trunk/engines/gob/sound/adlib.cpp	2010-01-01 21:04:20 UTC (rev 46850)
+++ scummvm/trunk/engines/gob/sound/adlib.cpp	2010-01-01 21:18:19 UTC (rev 46851)
@@ -247,7 +247,7 @@
 }
 
 void AdLib::setVolume(byte voice, byte volume) {
-	volume = 0x3F - (volume * 0x7E + 0x7F) / 0xFE;
+	volume = 0x3F - ((volume * 0x7E) + 0x7F) / 0xFE;
 	writeOPL(0x40 + _volRegNums[voice], volume);
 }
 
@@ -598,7 +598,7 @@
 	uint8 timbre;
 
 	if (_first) {
-		for (int i = 0; i < 11; i ++)
+		for (int i = 0; i < 9; i ++)
 			setVolume(i, 0);
 
 //	TODO : Set pitch range


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