Skip to content

Commit

Permalink
LZMA2: ensure that GetCompressionMem doesn't return values more than …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
bulatz committed Sep 22, 2009
1 parent 5f4bec0 commit 2b4c6d5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Compression/LZMA2/C_LZMA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit 2b4c6d5

Please sign in to comment.