mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 10:01:15 -04:00
Merge branch 'fanf-random-init-fuzz' into 'main'
Ensure the first random number is non-zero when fuzzing See merge request isc-projects/bind9!6794
This commit is contained in:
commit
7f4889e159
1 changed files with 5 additions and 6 deletions
|
|
@ -90,17 +90,16 @@ next(void) {
|
|||
}
|
||||
void
|
||||
isc__random_initialize(void) {
|
||||
int useed[4] = { 0, 0, 0, 1 };
|
||||
#if FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
/*
|
||||
* Set a constant seed to help in problem reproduction should fuzzing
|
||||
* find a crash or a hang. The seed array must be non-zero else
|
||||
* xoshiro128starstar will generate an infinite series of zeroes.
|
||||
* A fixed seed helps with problem reproduction when fuzzing. It must be
|
||||
* non-zero else xoshiro128starstar will generate only zeroes, and the
|
||||
* first result needs to be non-zero as expected by random_test.c
|
||||
*/
|
||||
seed[0] = 1;
|
||||
#else /* if FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION */
|
||||
isc_entropy_get(useed, sizeof(useed));
|
||||
isc_entropy_get(seed, sizeof(seed));
|
||||
#endif /* if FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION */
|
||||
memmove(seed, useed, sizeof(seed));
|
||||
}
|
||||
|
||||
uint8_t
|
||||
|
|
|
|||
Loading…
Reference in a new issue