0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-19 19:42:24 +02:00

misc/random: set constant seed for fuzzing

Fuzzing expect deterministic behavior. While we don't use this random
generator for anything significant, still good to set the seed, in case
of future usage.
This commit is contained in:
Kacper Michajłow 2024-06-23 16:45:51 +02:00
parent 799137a87c
commit a949e0c2d5

View File

@ -41,6 +41,9 @@ static inline uint64_t splitmix64(uint64_t *const x)
void mp_rand_seed(uint64_t seed)
{
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
seed = 42;
#endif
mp_mutex_lock(&state_mutex);
state[0] = seed;
for (int i = 1; i < 4; i++)