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
devs/lauromoura/tcautomated
Mike Blumenkrantz 4 years ago committed by Lauro Moura
parent 7e7465379f
commit 345dbe26b7
  1. 2
      src/static_libs/lz4/lz4frame.c

@ -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…
Cancel
Save