From: Stella Lau Date: Wed, 6 Sep 2017 03:41:37 +0000 (-0700) Subject: Fix setting of nextToUpdate at end of ldm matcher X-Git-Tag: fuzz-corpora2~10^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98b85426f1e777b6e607dc1281e292dc00a2f6e5;p=thirdparty%2Fzstd.git Fix setting of nextToUpdate at end of ldm matcher --- diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 7863fae0a..bbca6729d 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -1030,6 +1030,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, } /* ldm space */ + /* TODO */ if (params.ldmParams.enableLdm) { size_t const ldmHSize = ((size_t)1) << params.ldmParams.hashLog; size_t const ldmBucketSize = @@ -3580,7 +3581,7 @@ size_t ZSTD_compressBlock_ldm_generic(ZSTD_CCtx* cctx, ZSTD_ldm_fillFastTables(cctx, anchor); lastLiterals = blockCompressor(cctx, anchor, iend - anchor); - cctx->nextToUpdate = (U32)(ip - base); + cctx->nextToUpdate = (U32)(iend - base); /* Restore seqStorePtr->rep */ for (i = 0; i < ZSTD_REP_NUM; i++) @@ -3805,7 +3806,7 @@ static size_t ZSTD_compressBlock_ldm_extDict_generic( /* Call the block compressor one last time on the last literals */ lastLiterals = blockCompressor(ctx, anchor, iend - anchor); - ctx->nextToUpdate = (U32)(ip - base); + ctx->nextToUpdate = (U32)(iend - base); /* Restore seqStorePtr->rep */ for (i = 0; i < ZSTD_REP_NUM; i++)