From 64bf8ffce64ea2f52beba03f6531a1c3001763c3 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Fri, 27 Jan 2017 17:25:07 -0800 Subject: [PATCH] report @terrelln patch to ST fuzzer tests --- tests/zstreamtest.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/zstreamtest.c b/tests/zstreamtest.c index e451535c4..0fdb1ee12 100644 --- a/tests/zstreamtest.c +++ b/tests/zstreamtest.c @@ -691,10 +691,13 @@ static int fuzzerTests(U32 seed, U32 nbTests, unsigned startTest, double compres size_t const randomCSrcSize = FUZ_randomLength(&lseed, maxSampleLog); size_t const randomDstSize = FUZ_randomLength(&lseed, maxSampleLog); size_t const adjustedDstSize = MIN(dstBufferSize - outBuff.pos, randomDstSize); + size_t const adjustedCSrcSize = MIN(cSize - inBuff.pos, randomCSrcSize); outBuff.size = outBuff.pos + adjustedDstSize; - inBuff.size = inBuff.pos + randomCSrcSize; + inBuff.size = inBuff.pos + adjustedCSrcSize; { size_t const decompressError = ZSTD_decompressStream(zd, &outBuff, &inBuff); if (ZSTD_isError(decompressError)) break; /* error correctly detected */ + /* No forward progress possible */ + if (outBuff.pos < outBuff.size && inBuff.pos == cSize) break; } } } } DISPLAY("\r%u fuzzer tests completed \n", testNb);