[Scummvm-cvs-logs] SF.net SVN: scummvm:[47090] scummvm/trunk/engines/sci

waltervn at users.sourceforge.net waltervn at users.sourceforge.net
Wed Jan 6 21:22:01 CET 2010


Revision: 47090
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47090&view=rev
Author:   waltervn
Date:     2010-01-06 20:22:00 +0000 (Wed, 06 Jan 2010)

Log Message:
-----------
SCI: Fix overflow in LZS decompressor

Modified Paths:
--------------
    scummvm/trunk/engines/sci/decompressor.cpp
    scummvm/trunk/engines/sci/decompressor.h

Modified: scummvm/trunk/engines/sci/decompressor.cpp
===================================================================
--- scummvm/trunk/engines/sci/decompressor.cpp	2010-01-06 18:59:39 UTC (rev 47089)
+++ scummvm/trunk/engines/sci/decompressor.cpp	2010-01-06 20:22:00 UTC (rev 47090)
@@ -901,7 +901,8 @@
 }
 
 int DecompressorLZS::unpackLZS() {
-	uint16 offs = 0, clen;
+	uint16 offs = 0;
+	uint32 clen;
 
 	while (!isFinished()) {
 		if (getBitsMSB(1)) { // Compressed bytes follow
@@ -928,8 +929,9 @@
 	return _dwWrote == _szUnpacked ? 0 : SCI_ERROR_DECOMPRESSION_ERROR;
 }
 
-uint16 DecompressorLZS::getCompLen() {
-	int clen, nibble;
+uint32 DecompressorLZS::getCompLen() {
+	uint32 clen;
+	int nibble;
 	// The most probable cases are hardcoded
 	switch (getBitsMSB(2)) {
 	case 0:
@@ -958,7 +960,7 @@
 	}
 }
 
-void DecompressorLZS::copyComp(int offs, int clen) {
+void DecompressorLZS::copyComp(int offs, uint32 clen) {
 	int hpos = _dwWrote - offs;
 
 	while (clen--)

Modified: scummvm/trunk/engines/sci/decompressor.h
===================================================================
--- scummvm/trunk/engines/sci/decompressor.h	2010-01-06 18:59:39 UTC (rev 47089)
+++ scummvm/trunk/engines/sci/decompressor.h	2010-01-06 20:22:00 UTC (rev 47090)
@@ -192,8 +192,8 @@
 	int unpack(Common::ReadStream *src, byte *dest, uint32 nPacked, uint32 nUnpacked);
 protected:
 	int unpackLZS();
-	uint16 getCompLen();
-	void copyComp(int offs, int clen);
+	uint32 getCompLen();
+	void copyComp(int offs, uint32 clen);
 };
 #endif
 


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