From 2b4c6d5203b61567b335c5cc5df746788264cc00 Mon Sep 17 00:00:00 2001 From: bulatz Date: Tue, 22 Sep 2009 12:25:41 +0000 Subject: [PATCH] LZMA2: ensure that GetCompressionMem doesn't return values more than 4gb BUT don't modify dictionary while parsing method definition [+1] git-svn-id: https://freearc.svn.sourceforge.net/svnroot/freearc@632 3a4f7f31-9599-433d-91b1-573e8b61252c --- Compression/LZMA2/C_LZMA.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Compression/LZMA2/C_LZMA.cpp b/Compression/LZMA2/C_LZMA.cpp index fe1a829..3c584ed 100644 --- a/Compression/LZMA2/C_LZMA.cpp +++ b/Compression/LZMA2/C_LZMA.cpp @@ -418,10 +418,10 @@ MemSize LZMA_METHOD::GetCompressionMem (void) props.writeEndMark = 1; LzmaEncProps_Normalize(&props); - MemSize reservedArea = props.dictSize/(matchFinder==kHT4? 4 : 2); - uint64 sons = matchFinder==kHT4? 0 - : matchFinder==kHC4? 1 - : 2; + uint64 reservedArea = props.dictSize/(matchFinder==kHT4? 4 : 2); + uint64 sons = matchFinder==kHT4? 0 + : matchFinder==kHC4? 1 + : 2; // Возращаем значение не более 4gb-1 return MemSize (mymin (MemSize(-1), uint64(props.dictSize) + reservedArea + props.hashSize + sons*sizeof(CLzRef)*props.dictSize + 1*mb)); }