From: Yann Collet Date: Mon, 20 Jun 2016 16:31:25 +0000 (+0200) Subject: fixed corruption error related to inter-blocks rep-offset X-Git-Tag: v0.7.1~2^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5477cc25f7fb2ed3289f6b9854247dec1abb2852;p=thirdparty%2Fzstd.git fixed corruption error related to inter-blocks rep-offset --- diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 7f71395da..4bb982e6c 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -1186,8 +1186,8 @@ void ZSTD_compressBlock_fast_generic(ZSTD_CCtx* cctx, } } } /* save reps for next block */ - cctx->savedRep[0] = offset_1 ? (U32)offset_1 : (U32)(iend-base); - cctx->savedRep[1] = offset_2 ? (U32)offset_2 : (U32)(iend-base); + cctx->savedRep[0] = offset_1 ? (U32)offset_1 : (U32)(1 GB); + cctx->savedRep[1] = offset_2 ? (U32)offset_2 : (U32)(1 GB); /* Last Literals */ { size_t const lastLLSize = iend - anchor; @@ -1844,7 +1844,7 @@ _storeSequence: /* Save reps for next block */ { int i; for (i=0; ibase); /* in case some zero are left */ + if (!rep[i]) rep[i] = (U32)(1 GB); /* in case some zero are left */ ctx->savedRep[i] = rep[i]; } }