assert() the failed test
authorYann Collet <cyan@fb.com>
Mon, 15 Apr 2019 09:11:59 +0000 (02:11 -0700)
committerYann Collet <cyan@fb.com>
Mon, 15 Apr 2019 09:11:59 +0000 (02:11 -0700)
ensure canary remains within buffer limits

tests/frametest.c

index e4205a3..b1c7c02 100644 (file)
@@ -893,6 +893,7 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi
                 DISPLAYLEVEL(7,"canaryByte at pos %u / %u \n",
                             (unsigned)((size_t)(op - (BYTE*)compressedBuffer) + dstEndSize),
                             (unsigned)compressedBufferSize);
+                assert(op + dstEndSize < (BYTE*)compressedBuffer + compressedBufferSize);
                 op[dstEndSize] = canaryByte;
                 result = LZ4F_compressEnd(cCtx, op, dstEndSize, &cOptions);
                 CHECK(op[dstEndSize] != canaryByte, "LZ4F_compressEnd writes beyond dstCapacity !");