From: Yann Collet Date: Tue, 2 Feb 2016 15:00:50 +0000 (+0100) Subject: fixed encoding bugs X-Git-Tag: v0.5.0~1^2~3^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a6343fb1bf73f4108a838f001b6836c9ac11465;p=thirdparty%2Fzstd.git fixed encoding bugs --- diff --git a/lib/zstd_compress.c b/lib/zstd_compress.c index 7252d750b..3dd865151 100644 --- a/lib/zstd_compress.c +++ b/lib/zstd_compress.c @@ -251,6 +251,7 @@ size_t ZSTD_copyCCtx(ZSTD_CCtx* dstCCtx, const ZSTD_CCtx* srcCCtx) dstCCtx->dictBase = srcCCtx->dictBase; dstCCtx->dictLimit = srcCCtx->dictLimit; dstCCtx->lowLimit = srcCCtx->lowLimit; + dstCCtx->loadedDictEnd = srcCCtx->loadedDictEnd; /* copy entropy tables */ dstCCtx->flagStaticTables = srcCCtx->flagStaticTables; @@ -1911,7 +1912,8 @@ static size_t ZSTD_compress_generic (ZSTD_CCtx* zc, if (remaining < blockSize) blockSize = remaining; if ((U32)(ip+blockSize - zc->base) > zc->loadedDictEnd + maxDist) { /* enforce maxDist */ - zc->lowLimit = (U32)(ip+blockSize - zc->base) - maxDist; + U32 newLowLimit = (U32)(ip+blockSize - zc->base) - maxDist; + if (zc->lowLimit < newLowLimit) zc->lowLimit = newLowLimit; if (zc->dictLimit < zc->lowLimit) zc->dictLimit = zc->lowLimit; }