[Scummvm-cvs-logs] CVS: scummvm/sky disk.cpp,1.42,1.43

Joost Peters joostp at users.sourceforge.net
Wed Jul 16 06:56:13 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv32552/sky

Modified Files:
	disk.cpp 
Log Message:
Quick-Fix for the OOB access in RNC decoder.
Obviously this should be fixed in the decoder itself,
but for some reason I couldn't get it to work in a short period of time.
(before every offending READ_UINT16(), I had a call to function that was like this: "if ((_srcPtr - _startPtr) >= _packLen) { _srcPtr -= 2; }", note that _srcPtr is the current position in the buffer, _startPos is the starting position of the buffer and _packLen is the (supposed?) size. 
but I would still get "Invalid Read of 2" with this in Valgrind ..maybe someone knows what I did wrong?)

Index: disk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/disk.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- disk.cpp	13 Jul 2003 16:22:16 -0000	1.42
+++ disk.cpp	16 Jul 2003 13:55:18 -0000	1.43
@@ -147,7 +147,7 @@
 	_compDest = dest;
 
 	if (dest == NULL) //we need to allocate memory for this file
-		_fileDest = (uint8 *)malloc(_fileSize);
+		_fileDest = (uint8 *)malloc(_fileSize + 4);
 
 	_dataDiskHandle->seek(_fileOffset, SEEK_SET);
 





More information about the Scummvm-git-logs mailing list