Skip to content

Commit

Permalink
Fix Buffer Overflow in Legacy (v0.3) Raw Literals Decompression
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhandte committed Aug 15, 2019
1 parent 87e3122 commit a42bbb4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/legacy/zstd_v03.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a42bbb4

Please sign in to comment.