lauromoura pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=345dbe26b797bb528a98ac4f4153351093d47431

commit 345dbe26b797bb528a98ac4f4153351093d47431
Author: Mike Blumenkrantz <zm...@samsung.com>
Date:   Tue Oct 15 11:20:53 2019 -0300

    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
---
 src/static_libs/lz4/lz4frame.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/static_libs/lz4/lz4frame.c b/src/static_libs/lz4/lz4frame.c
index a10e4af09e..95da80ec32 100644
--- a/src/static_libs/lz4/lz4frame.c
+++ b/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);

-- 


Reply via email to