diff options
author | Yann Collet <yann.collet.73@gmail.com> | 2015-03-15 00:42:27 (GMT) |
---|---|---|
committer | Yann Collet <yann.collet.73@gmail.com> | 2015-03-15 00:42:27 (GMT) |
commit | 45b0642bf54718d2b57dd61cb606b154afc0ab26 (patch) | |
tree | f5321a260b8491e9f233166402b92f8c4ff68fb0 /programs/frametest.c | |
parent | a18fb4392a9f249528a4071a5583e17668d92872 (diff) | |
download | lz4-45b0642bf54718d2b57dd61cb606b154afc0ab26.zip lz4-45b0642bf54718d2b57dd61cb606b154afc0ab26.tar.gz lz4-45b0642bf54718d2b57dd61cb606b154afc0ab26.tar.bz2 |
scan-build tests
Diffstat (limited to 'programs/frametest.c')
-rw-r--r-- | programs/frametest.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/programs/frametest.c b/programs/frametest.c index df37e5f..c69de8c 100644 --- a/programs/frametest.c +++ b/programs/frametest.c @@ -263,6 +263,7 @@ int basicTests(U32 seed, double compressibility) DISPLAYLEVEL(3, "Single Block : \n"); errorCode = LZ4F_decompress(dCtx, decodedBuffer, &decodedBufferSize, compressedBuffer, &compressedBufferSize, NULL); + if (LZ4F_isError(errorCode)) goto _output_error; crcDest = XXH64(decodedBuffer, COMPRESSIBLE_NOISE_LENGTH, 1); if (crcDest != crcOrig) goto _output_error; DISPLAYLEVEL(3, "Regenerated %i bytes \n", (int)decodedBufferSize); @@ -418,7 +419,7 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi # define CHECK(cond, ...) if (cond) { DISPLAY("Error => "); DISPLAY(__VA_ARGS__); \ DISPLAY(" (seed %u, test nb %u) \n", seed, testNb); goto _output_error; } - // Create buffers + /* Create buffers */ result = LZ4F_createDecompressionContext(&dCtx, LZ4F_VERSION); CHECK(LZ4F_isError(result), "Allocation failed (error %i)", (int)result); result = LZ4F_createCompressionContext(&cCtx, LZ4F_VERSION); @@ -427,14 +428,14 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi CHECK(srcBuffer==NULL, "srcBuffer Allocation failed"); compressedBuffer = malloc(LZ4F_compressFrameBound(srcDataLength, NULL)); CHECK(compressedBuffer==NULL, "compressedBuffer Allocation failed"); - decodedBuffer = malloc(srcDataLength); + decodedBuffer = calloc(1, srcDataLength); /* calloc avoids decodedBuffer being considered "garbage" by scan-build */ CHECK(decodedBuffer==NULL, "decodedBuffer Allocation failed"); FUZ_fillCompressibleNoiseBuffer(srcBuffer, srcDataLength, compressibility, &coreRand); - // jump to requested testNb + /* jump to requested testNb */ for (testNb =0; testNb < startTest; testNb++) (void)FUZ_rand(&coreRand); // sync randomizer - // main fuzzer loop + /* main fuzzer test loop */ for ( ; testNb < nbTests; testNb++) { U32 randState = coreRand ^ prime1; |