Merge pull request #1722 from felixhandte/legacy-decompression-fix
Fix Buffer Overflow in Legacy (v0.3) Raw Literals Decompression
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
v1.4.3
|
v1.4.3
|
||||||
bug: Fix Dictionary Compression Ratio Regression by @cyan4973 (#1709)
|
bug: Fix Dictionary Compression Ratio Regression by @cyan4973 (#1709)
|
||||||
|
bug: Fix Buffer Overflow in v0.3 Decompression by @felixhandte (#1722)
|
||||||
build: Add support for IAR C/C++ Compiler for Arm by @joseph0918 (#1705)
|
build: Add support for IAR C/C++ Compiler for Arm by @joseph0918 (#1705)
|
||||||
misc: Add NULL pointer check in util.c by @leeyoung624 (#1706)
|
misc: Add NULL pointer check in util.c by @leeyoung624 (#1706)
|
||||||
|
|
||||||
|
|||||||
@@ -2530,6 +2530,7 @@ static size_t ZSTD_decodeLiteralsBlock(void* ctx,
|
|||||||
const size_t litSize = (MEM_readLE32(istart) & 0xFFFFFF) >> 2; /* no buffer issue : srcSize >= MIN_CBLOCK_SIZE */
|
const size_t litSize = (MEM_readLE32(istart) & 0xFFFFFF) >> 2; /* no buffer issue : srcSize >= MIN_CBLOCK_SIZE */
|
||||||
if (litSize > srcSize-11) /* risk of reading too far with wildcopy */
|
if (litSize > srcSize-11) /* risk of reading too far with wildcopy */
|
||||||
{
|
{
|
||||||
|
if (litSize > BLOCKSIZE) return ERROR(corruption_detected);
|
||||||
if (litSize > srcSize-3) return ERROR(corruption_detected);
|
if (litSize > srcSize-3) return ERROR(corruption_detected);
|
||||||
memcpy(dctx->litBuffer, istart, litSize);
|
memcpy(dctx->litBuffer, istart, litSize);
|
||||||
dctx->litPtr = dctx->litBuffer;
|
dctx->litPtr = dctx->litBuffer;
|
||||||
|
|||||||
Reference in New Issue
Block a user