Changeset - r19799:a3fcfb29a1e8
[Not reviewed]
master
0 1 0
rubidium - 12 years ago 2012-11-18 16:14:31
rubidium@openttd.org
(svn r24754) -Fix [FS#5367]: crash on corrupted savegame
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/saveload/saveload.cpp
Show inline comments
 
@@ -1904,25 +1904,25 @@ struct LZOLoadFilter : LoadFilter {
 
			size = TO_BE32(size);
 
		}
 

	
 
		if (size >= sizeof(out)) SlErrorCorrupt("Inconsistent size");
 

	
 
		/* Read block */
 
		if (this->chain->Read(out + sizeof(uint32), size) != size) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE);
 

	
 
		/* Verify checksum */
 
		if (tmp[0] != lzo_adler32(0, out, size + sizeof(uint32))) SlErrorCorrupt("Bad checksum");
 

	
 
		/* Decompress */
 
		lzo1x_decompress(out + sizeof(uint32) * 1, size, buf, &len, NULL);
 
		lzo1x_decompress_safe(out + sizeof(uint32) * 1, size, buf, &len, NULL);
 
		return len;
 
	}
 
};
 

	
 
/** Filter using LZO compression. */
 
struct LZOSaveFilter : SaveFilter {
 
	/**
 
	 * Initialise this filter.
 
	 * @param chain             The next filter in this chain.
 
	 * @param compression_level The requested level of compression.
 
	 */
 
	LZOSaveFilter(SaveFilter *chain, byte compression_level) : SaveFilter(chain)
0 comments (0 inline, 0 general)