]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed corruption error related to inter-blocks rep-offset
authorYann Collet <yann.collet.73@gmail.com>
Mon, 20 Jun 2016 16:31:25 +0000 (18:31 +0200)
committerYann Collet <yann.collet.73@gmail.com>
Mon, 20 Jun 2016 16:31:25 +0000 (18:31 +0200)
lib/compress/zstd_compress.c

index 7f71395dae95de0c7e518fef08a010f0d5c8cae4..4bb982e6c1c0a3302d41892dc2b8f607eb397f32 100644 (file)
@@ -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; i<ZSTD_REP_NUM; i++) {
-            if (!rep[i]) rep[i] = (U32)(iend - ctx->base);   /* 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];
     }   }