detect early impossible decompression scenario in legacy decoder v0.5

dev
Yann Collet 2016-10-18 13:48:32 -07:00
parent 9313c8d953
commit f7906d5955
2 changed files with 5 additions and 3 deletions

1
NEWS
View File

@ -1,5 +1,6 @@
v1.1.1
New : command -M#, --memory=, --memlimit=, --memlimit-decompress= to limit allowed memory consumption
Changed : zstd_errors.h is now part of include installation
v1.1.0
New : contrib/pzstd, parallel version of zstd, by Nick Terrell

View File

@ -2032,13 +2032,14 @@ size_t HUFv05_decompress1X2_usingDTable(
{
BYTE* op = (BYTE*)dst;
BYTE* const oend = op + dstSize;
size_t errorCode;
const U32 dtLog = DTable[0];
const void* dtPtr = DTable;
const HUFv05_DEltX2* const dt = ((const HUFv05_DEltX2*)dtPtr)+1;
BITv05_DStream_t bitD;
errorCode = BITv05_initDStream(&bitD, cSrc, cSrcSize);
if (HUFv05_isError(errorCode)) return errorCode;
if (dstSize <= cSrcSize) return ERROR(dstSize_tooSmall);
{ size_t const errorCode = BITv05_initDStream(&bitD, cSrc, cSrcSize);
if (HUFv05_isError(errorCode)) return errorCode; }
HUFv05_decodeStreamX2(op, &bitD, oend, dt, dtLog);