]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed msan test
authorYann Collet <cyan@fb.com>
Sat, 6 Jan 2018 19:50:36 +0000 (20:50 +0100)
committerYann Collet <cyan@fb.com>
Sat, 6 Jan 2018 19:50:36 +0000 (20:50 +0100)
a pointer calculation was wrong in a corner case

lib/compress/zstd_lazy.c

index 7261cffcf094a9231046ec4abb4fd51c4c172efb..4af843d1bf113a6d25ca228175a92d37eff670d0 100644 (file)
@@ -122,7 +122,7 @@ static void ZSTD_insertDUBT1(ZSTD_CCtx* zc,
         if ( (!extDict)
           || (matchIndex+matchLength >= dictLimit)  /* both in current segment*/
           || (current < dictLimit) /* both in extDict */) {
-            const BYTE* const mBase = !extDict || (matchIndex >= dictLimit) ? base : dictBase;
+            const BYTE* const mBase = !extDict || ((matchIndex+matchLength) >= dictLimit) ? base : dictBase;
             assert( (matchIndex+matchLength >= dictLimit)   /* might be wrong if extDict is incorrectly set to 0 */
                  || (current < dictLimit) );
             match = mBase + matchIndex;