summaryrefslogtreecommitdiffstats
path: root/programs
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2016-08-10 07:14:11 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2016-08-10 07:14:11 (GMT)
commit828332d23689361f0faf73c3a4dd25970e34aa98 (patch)
tree781a4ca9f47bc976e35d517d15987cf42c71ec54 /programs
parentb130fd59233925d6f8603d18270c3219e7672985 (diff)
downloadlz4-828332d23689361f0faf73c3a4dd25970e34aa98.zip
lz4-828332d23689361f0faf73c3a4dd25970e34aa98.tar.gz
lz4-828332d23689361f0faf73c3a4dd25970e34aa98.tar.bz2
fixed : fuzzer test, reported by @setharnold (#203)
Diffstat (limited to 'programs')
-rw-r--r--programs/fuzzer.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/programs/fuzzer.c b/programs/fuzzer.c
index 60fd64f..7957f64 100644
--- a/programs/fuzzer.c
+++ b/programs/fuzzer.c
@@ -58,7 +58,7 @@
#endif
-/**************************************
+/*-************************************
* Basic Types
**************************************/
#if defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */
@@ -77,7 +77,7 @@ typedef unsigned long long U64;
#endif
-/**************************************
+/*-************************************
* Constants
**************************************/
#ifndef LZ4_VERSION
@@ -98,7 +98,7 @@ typedef unsigned long long U64;
#define GB *(1U<<30)
-/*****************************************
+/*-***************************************
* Macros
*****************************************/
#define DISPLAY(...) fprintf(stderr, __VA_ARGS__)
@@ -108,7 +108,7 @@ static const U32 g_refreshRate = 250;
static U32 g_time = 0;
-/*********************************************************
+/*-*******************************************************
* Fuzzer functions
*********************************************************/
#if defined(FUZ_LEGACY_TIMER)
@@ -388,7 +388,7 @@ static int FUZ_test(U32 seed, U32 nbCycles, const U32 startCycle, const double c
randState = coreRandState ^ PRIME3;
/* Select block to test */
- blockSize = FUZ_rand(&randState) % FUZ_MAX_BLOCK_SIZE;
+ blockSize = (FUZ_rand(&randState) % (FUZ_MAX_BLOCK_SIZE-1)) + 1;
blockStart = FUZ_rand(&randState) % (COMPRESSIBLE_NOISE_LENGTH - blockSize);
dictSize = FUZ_rand(&randState) % FUZ_MAX_DICT_SIZE;
if (dictSize > blockStart) dictSize = blockStart;