fixed fuzz test src code

This commit is contained in:
Yann Collet
2018-11-14 14:46:49 -08:00
parent 7b0391e37e
commit cf9f4b63b8
4 changed files with 165 additions and 174 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ static size_t roundTripTest(void *result, size_t resultCapacity,
ZSTD_outBuffer out = {compressed, compressedCapacity, 0};
size_t err;
ZSTD_CCtx_reset(cctx);
ZSTD_CCtx_reset(cctx, ZSTD_CCtx_reset_session_only);
FUZZ_setRandomParameters(cctx, srcSize, &seed);
err = ZSTD_compress_generic(cctx, &out, &in, ZSTD_e_end);
FUZZ_ZASSERT(err);
+2 -2
View File
@@ -56,7 +56,7 @@ static size_t compress(uint8_t *dst, size_t capacity,
const uint8_t *src, size_t srcSize)
{
size_t dstSize = 0;
ZSTD_CCtx_reset(cctx);
ZSTD_CCtx_reset(cctx, ZSTD_CCtx_reset_session_only);
FUZZ_setRandomParameters(cctx, srcSize, &seed);
while (srcSize > 0) {
@@ -84,7 +84,7 @@ static size_t compress(uint8_t *dst, size_t capacity,
FUZZ_ZASSERT(ret);
/* Reset the compressor when the frame is finished */
if (ret == 0) {
ZSTD_CCtx_reset(cctx);
ZSTD_CCtx_reset(cctx, ZSTD_CCtx_reset_session_only);
if ((FUZZ_rand(&seed) & 7) == 0) {
size_t const remaining = in.size - in.pos;
FUZZ_setRandomParameters(cctx, remaining, &seed);