[Scummvm-cvs-logs] SF.net SVN: scummvm: [30934] scummvm/trunk/engines/scumm/smush/codec47.cpp

robinwatts at users.sourceforge.net robinwatts at users.sourceforge.net
Sat Feb 23 19:57:50 CET 2008


Revision: 30934
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30934&view=rev
Author:   robinwatts
Date:     2008-02-23 10:57:49 -0800 (Sat, 23 Feb 2008)

Log Message:
-----------
Make codec47 cope with failed mallocs.

Not the nicest result in the world, but better than crashing and burning...

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/smush/codec47.cpp

Modified: scummvm/trunk/engines/scumm/smush/codec47.cpp
===================================================================
--- scummvm/trunk/engines/scumm/smush/codec47.cpp	2008-02-23 18:57:27 UTC (rev 30933)
+++ scummvm/trunk/engines/scumm/smush/codec47.cpp	2008-02-23 18:57:49 UTC (rev 30934)
@@ -531,8 +531,10 @@
 	_height = height;
 	_tableBig = (byte *)malloc(256 * 388);
 	_tableSmall = (byte *)malloc(256 * 128);
-	makeTablesInterpolation(4);
-	makeTablesInterpolation(8);
+	if ((_tableBig != NULL) && (_tableSmall != NULL)) {
+		makeTablesInterpolation(4);
+		makeTablesInterpolation(8);
+	}
 
 	_frameSize = _width * _height;
 	_deltaSize = _frameSize * 3;
@@ -562,6 +564,9 @@
 }
 
 bool Codec47Decoder::decode(byte *dst, const byte *src) {
+	if ((_tableBig == NULL) || (_tableSmall == NULL) || (_deltaBuf == NULL))
+		return false;
+  
 	_offset1 = _deltaBufs[1] - _curBuf;
 	_offset2 = _deltaBufs[0] - _curBuf;
 


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