forked from enlightenment/efl
lz4: fix potential div by zero
Summary: LZ4F_getBlockSize() can return 0 CID 1404010 Reviewers: lauromoura Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10392
This commit is contained in:
parent
8d4e542f71
commit
962c4c5793
|
@ -334,7 +334,7 @@ static size_t LZ4F_compressBound_internal(size_t srcSize,
|
|||
size_t const maxBuffered = blockSize - 1;
|
||||
size_t const bufferedSize = MIN(alreadyBuffered, maxBuffered);
|
||||
size_t const maxSrcSize = srcSize + bufferedSize;
|
||||
unsigned const nbFullBlocks = (unsigned)(maxSrcSize / blockSize);
|
||||
unsigned const nbFullBlocks = blockSize ? (unsigned)(maxSrcSize / blockSize) : 0;
|
||||
size_t const partialBlockSize = maxSrcSize & (blockSize-1);
|
||||
size_t const lastBlockSize = flush ? partialBlockSize : 0;
|
||||
unsigned const nbBlocks = nbFullBlocks + (lastBlockSize>0);
|
||||
|
|
Loading…
Reference in New Issue