fixed : fuzzer test, reported by @setharnold (#203)

This commit is contained in:
Yann Collet 2016-08-10 09:14:11 +02:00
parent b130fd5923
commit 828332d236

View File

@ -58,7 +58,7 @@
#endif #endif
/************************************** /*-************************************
* Basic Types * Basic Types
**************************************/ **************************************/
#if defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */ #if defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */
@ -77,7 +77,7 @@ typedef unsigned long long U64;
#endif #endif
/************************************** /*-************************************
* Constants * Constants
**************************************/ **************************************/
#ifndef LZ4_VERSION #ifndef LZ4_VERSION
@ -98,7 +98,7 @@ typedef unsigned long long U64;
#define GB *(1U<<30) #define GB *(1U<<30)
/***************************************** /*-***************************************
* Macros * Macros
*****************************************/ *****************************************/
#define DISPLAY(...) fprintf(stderr, __VA_ARGS__) #define DISPLAY(...) fprintf(stderr, __VA_ARGS__)
@ -108,7 +108,7 @@ static const U32 g_refreshRate = 250;
static U32 g_time = 0; static U32 g_time = 0;
/********************************************************* /*-*******************************************************
* Fuzzer functions * Fuzzer functions
*********************************************************/ *********************************************************/
#if defined(FUZ_LEGACY_TIMER) #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; randState = coreRandState ^ PRIME3;
/* Select block to test */ /* 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); blockStart = FUZ_rand(&randState) % (COMPRESSIBLE_NOISE_LENGTH - blockSize);
dictSize = FUZ_rand(&randState) % FUZ_MAX_DICT_SIZE; dictSize = FUZ_rand(&randState) % FUZ_MAX_DICT_SIZE;
if (dictSize > blockStart) dictSize = blockStart; if (dictSize > blockStart) dictSize = blockStart;