]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed offset in this case os that it always goes past src start
authorPaul Cruz <paulcruz74@fb.com>
Thu, 22 Jun 2017 01:47:40 +0000 (18:47 -0700)
committerPaul Cruz <paulcruz74@fb.com>
Thu, 22 Jun 2017 01:47:40 +0000 (18:47 -0700)
tests/decodecorpus.c

index dfda939238084f7440c0f64ba9e991c972f10447..3e20b3ba5bd4b4a93a28664efac44980da60de3b 100644 (file)
@@ -683,8 +683,8 @@ static U32 generateSequences(U32* seed, frame_t* frame, seqStore_t* seqStore,
                          1;
                 if (info.useDict && (RAND(seed) & 1)) {
                     /* need to occasionally generate offsets that go past the start */
-                    U32 const lenPastStart = RAND(seed) % info.dictContentSize;
-                    offset = offset+lenPastStart;
+                    U32 const lenPastStart = RAND(seed) % info.dictContentSize + 1;
+                    offset = ((BYTE*)srcPtr - (BYTE*)frame->srcStart)+lenPastStart;
                 }
                 offsetCode = offset + ZSTD_REP_MOVE;
                 repIndex = 2;