Return error if block size exceeds maximum

This commit is contained in:
Vivek Miglani 2019-07-15 12:10:21 -07:00
parent de61b36f9e
commit 3f108f82fb

View File

@ -909,6 +909,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, c
{ blockProperties_t bp; { blockProperties_t bp;
size_t const cBlockSize = ZSTD_getcBlockSize(src, ZSTD_blockHeaderSize, &bp); size_t const cBlockSize = ZSTD_getcBlockSize(src, ZSTD_blockHeaderSize, &bp);
if (ZSTD_isError(cBlockSize)) return cBlockSize; if (ZSTD_isError(cBlockSize)) return cBlockSize;
RETURN_ERROR_IF(cBlockSize > ZSTD_BLOCKSIZE_MAX, corruption_detected, "Block Size Exceeds Maximum");
dctx->expected = cBlockSize; dctx->expected = cBlockSize;
dctx->bType = bp.blockType; dctx->bType = bp.blockType;
dctx->rleSize = bp.origSize; dctx->rleSize = bp.origSize;