From: Yann Collet Date: Tue, 6 Dec 2016 05:11:46 +0000 (+0100) Subject: fixed fuzzer test X-Git-Tag: v1.1.2~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f586bdfe230395ff3a1731acff17fdd8f98caec0;p=thirdparty%2Fzstd.git fixed fuzzer test --- diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 1c1ae470a..86d4c6beb 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -246,6 +246,7 @@ static int basicUnitTests(U32 seed, double compressibility) size_t const sampleUnitSize = 8 KB; U32 const nbSamples = (U32)(totalSampleSize / sampleUnitSize); size_t* const samplesSizes = (size_t*) malloc(nbSamples * sizeof(size_t)); + U32 dictID; if (dictBuffer==NULL || samplesSizes==NULL) { free(dictBuffer); @@ -261,10 +262,9 @@ static int basicUnitTests(U32 seed, double compressibility) DISPLAYLEVEL(4, "OK, created dictionary of size %u \n", (U32)dictSize); DISPLAYLEVEL(4, "test%3i : check dictID : ", testNb++); - { U32 const dictID = ZDICT_getDictID(dictBuffer, dictSize); - if (dictID==0) goto _output_error; - DISPLAYLEVEL(4, "OK : %u \n", dictID); - } + dictID = ZDICT_getDictID(dictBuffer, dictSize); + if (dictID==0) goto _output_error; + DISPLAYLEVEL(4, "OK : %u \n", dictID); DISPLAYLEVEL(4, "test%3i : compress with dictionary : ", testNb++); cSize = ZSTD_compress_usingDict(cctx, compressedBuffer, ZSTD_compressBound(CNBuffSize), @@ -274,14 +274,14 @@ static int basicUnitTests(U32 seed, double compressibility) DISPLAYLEVEL(4, "OK (%u bytes : %.2f%%)\n", (U32)cSize, (double)cSize/CNBuffSize*100); DISPLAYLEVEL(4, "test%3i : retrieve dictID from dictionary : ", testNb++); - { U32 const dictID = ZSTD_getDictID_fromDict(dictBuffer, dictSize); - if (dictID != 0) goto _output_error; /* non-conformant (content-only) dictionary */ + { U32 const did = ZSTD_getDictID_fromDict(dictBuffer, dictSize); + if (did != dictID) goto _output_error; /* non-conformant (content-only) dictionary */ } DISPLAYLEVEL(4, "OK \n"); DISPLAYLEVEL(4, "test%3i : retrieve dictID from frame : ", testNb++); - { U32 const dictID = ZSTD_getDictID_fromFrame(compressedBuffer, cSize); - if (dictID != 0) goto _output_error; /* non-conformant (content-only) dictionary */ + { U32 const did = ZSTD_getDictID_fromFrame(compressedBuffer, cSize); + if (did != dictID) goto _output_error; /* non-conformant (content-only) dictionary */ } DISPLAYLEVEL(4, "OK \n");