[Scummvm-cvs-logs] SF.net SVN: scummvm:[54870] scummvm/trunk/engines/mohawk/livingbooks.cpp

fuzzie at users.sourceforge.net fuzzie at users.sourceforge.net
Sat Dec 11 20:53:44 CET 2010


Revision: 54870
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54870&view=rev
Author:   fuzzie
Date:     2010-12-11 19:53:44 +0000 (Sat, 11 Dec 2010)

Log Message:
-----------
MOHAWK: Add size check when reading LB messages

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/livingbooks.cpp

Modified: scummvm/trunk/engines/mohawk/livingbooks.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/livingbooks.cpp	2010-12-11 19:53:28 UTC (rev 54869)
+++ scummvm/trunk/engines/mohawk/livingbooks.cpp	2010-12-11 19:53:44 UTC (rev 54870)
@@ -1625,12 +1625,18 @@
 		if (stream->pos() == endPos)
 			break;
 
+		uint oldPos = stream->pos();
+
 		uint16 dataType = stream->readUint16();
 		uint16 dataSize = stream->readUint16();
 
 		debug(4, "Data type %04x, size %d", dataType, dataSize);
 		readData(dataType, dataSize, stream);
 
+		if ((uint)stream->pos() != oldPos + 4 + (uint)dataSize)
+			error("Failed to read correct number of bytes (off by %d) for data type %04x (size %d)",
+				(int)stream->pos() - (int)(oldPos + 4 + (uint)dataSize), dataType, dataSize);
+
 		if (stream->pos() > endPos)
 			error("Read off the end (at %d) of data (ends at %d)", stream->pos(), endPos);
 


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