mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +01:00
fuzz: make FuzzedDataProvider usage deterministic
There exist many usages of `fuzzed_data_provider` where it is evaluated directly in the function call. Unfortunately, the order of evaluation of function arguments is unspecified. This means it can differ between compilers/version/optimization levels etc. But when the evaluation order changes, the same fuzzing input will produce different output, which is bad for coverage/reproducibility. This PR fixes all these cases where by moving multiple calls to `fuzzed_data_provider` out of the function arguments.
This commit is contained in:
@@ -39,7 +39,9 @@ FUZZ_TARGET(message, .init = initialize_message)
|
||||
}
|
||||
{
|
||||
(void)MessageHash(random_message);
|
||||
(void)MessageVerify(fuzzed_data_provider.ConsumeRandomLengthString(1024), fuzzed_data_provider.ConsumeRandomLengthString(1024), random_message);
|
||||
auto address = fuzzed_data_provider.ConsumeRandomLengthString(1024);
|
||||
auto signature = fuzzed_data_provider.ConsumeRandomLengthString(1024);
|
||||
(void)MessageVerify(address, signature, random_message);
|
||||
(void)SigningResultString(fuzzed_data_provider.PickValueInArray({SigningResult::OK, SigningResult::PRIVATE_KEY_NOT_AVAILABLE, SigningResult::SIGNING_FAILED}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user