mirror of
https://github.com/facebook/zstd
synced 2026-08-22 22:32:07 -04:00
Fix Buffer Overflow in Legacy (v0.3) Raw Literals Decompression
This commit is contained in:
parent
87e31223e8
commit
a42bbb4e05
1 changed files with 1 additions and 0 deletions
|
|
@ -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 */
|
||||
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);
|
||||
memcpy(dctx->litBuffer, istart, litSize);
|
||||
dctx->litPtr = dctx->litBuffer;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue