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:
Mike Blumenkrantz 2019-10-15 11:20:53 -03:00
parent 8d4e542f71
commit 962c4c5793
1 changed files with 1 additions and 1 deletions

View File

@ -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);