From: Yann Collet Date: Sun, 3 Apr 2016 23:22:26 +0000 (+0200) Subject: stronger zbuff synchronization tests X-Git-Tag: v0.6.0^2~17^2~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15bc943201153630d3272485eb61a4405414a1b3;p=thirdparty%2Fzstd.git stronger zbuff synchronization tests --- diff --git a/programs/zbufftest.c b/programs/zbufftest.c index eba2c1510..8d9401340 100644 --- a/programs/zbufftest.c +++ b/programs/zbufftest.c @@ -286,8 +286,15 @@ static int fuzzerTests(U32 seed, U32 nbTests, unsigned startTest, double compres if (nbTests >= testNb) DISPLAYUPDATE(2, "/%6u ", nbTests); FUZ_rand(&coreSeed); lseed = coreSeed ^ prime1; + + /* random state complete reset */ + /* some problems only happen when states are re-used in a specific order */ + if ((FUZ_rand(&lseed) & 0xFF) == 131) { ZBUFF_freeCCtx(zc); zc = ZBUFF_createCCtx(); } + if ((FUZ_rand(&lseed) & 0xFF) == 132) { ZBUFF_freeDCtx(zd); zd = ZBUFF_createDCtx(); } + + /* srcBuffer selection */ buffNb = FUZ_rand(&lseed) & 0x7F; - if (buffNb & 7) buffNb=2; /* select srcBuffer */ + if (buffNb & 7) buffNb=2; else { buffNb >>= 3; if (buffNb & 7) {