Fuzzer improvements.
phase_of_moon and friday_13th determined using rn2() instead of local time if fuzzing. Don't reseed using init_random() if fuzzing. Allow set_random to be called outside of hacklib. rn2_on_display_rng uses rn2 if fuzzing so that we have a single source of random that we can ensure is reproducible. Implement rul() that returns a random unsigned long. Fix bug in fuzzer handling of ntposkey which would cause us to use unitialized values for x and y. Added command line arguments to allow auto starting and stopping of fuzzer. Add a logging facility for the fuzzer to use to record activity. Added some scripts used to automate fuzzer testing on windows.
This commit is contained in:
@@ -854,7 +854,7 @@ STATIC_DCL struct tm *NDECL(getlt);
|
||||
/* Sets the seed for the random number generator */
|
||||
#ifdef USE_ISAAC64
|
||||
|
||||
static void
|
||||
void
|
||||
set_random(seed, fn)
|
||||
unsigned long seed;
|
||||
int FDECL((*fn), (int));
|
||||
@@ -865,7 +865,7 @@ int FDECL((*fn), (int));
|
||||
#else /* USE_ISAAC64 */
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
void
|
||||
set_random(seed, fn)
|
||||
unsigned long seed;
|
||||
int FDECL((*fn), (int)) UNUSED;
|
||||
@@ -917,7 +917,7 @@ int FDECL((*fn), (int));
|
||||
{
|
||||
/* only reseed if we are certain that the seed generation is unguessable
|
||||
* by the players. */
|
||||
if (has_strong_rngseed)
|
||||
if (has_strong_rngseed && !iflags.debug_fuzzer)
|
||||
init_random(fn);
|
||||
}
|
||||
|
||||
@@ -1108,6 +1108,9 @@ phase_of_the_moon() /* 0-7, with 0: new, 4: full */
|
||||
register struct tm *lt = getlt();
|
||||
register int epact, diy, goldn;
|
||||
|
||||
if(iflags.debug_fuzzer)
|
||||
return rn2(8);
|
||||
|
||||
diy = lt->tm_yday;
|
||||
goldn = (lt->tm_year % 19) + 1;
|
||||
epact = (11 * goldn + 18) % 30;
|
||||
@@ -1122,6 +1125,9 @@ friday_13th()
|
||||
{
|
||||
register struct tm *lt = getlt();
|
||||
|
||||
if(iflags.debug_fuzzer)
|
||||
return rn2(30);
|
||||
|
||||
/* tm_wday (day of week; 0==Sunday) == 5 => Friday */
|
||||
return (boolean) (lt->tm_wday == 5 && lt->tm_mday == 13);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user