mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge bitcoin/bitcoin#22267: fuzz: Speed up crypto fuzz target
fa483e9f68b8b4171dabb25cc88dc2eada454a99 fuzz: Speed up crypto fuzz target (MarcoFalke) Pull request description: May fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34962 Similar solution to https://github.com/bitcoin/bitcoin/pull/22005 ACKs for top commit: practicalswift: cr ACK fa483e9f68b8b4171dabb25cc88dc2eada454a99: patch looks correct and rationale makes sense Tree-SHA512: 3788cf9f6ba0f7a0a217cd3a6a825839689425e99e4d6d657981d291a001b0da7c5abb50a68b4ee1c2a8300b87fb92e4e3ccc1171907792b40251e467c33bd53
This commit is contained in:
parent
3aab3efaa5
commit
9304ba040d
@ -19,6 +19,10 @@
|
||||
|
||||
FUZZ_TARGET(crypto)
|
||||
{
|
||||
// Hashing is expensive with sanitizers enabled, so limit the number of
|
||||
// calls
|
||||
int limit_max_ops{30};
|
||||
|
||||
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
|
||||
std::vector<uint8_t> data = ConsumeRandomLengthByteVector(fuzzed_data_provider);
|
||||
if (data.empty()) {
|
||||
@ -36,7 +40,7 @@ FUZZ_TARGET(crypto)
|
||||
SHA3_256 sha3;
|
||||
CSipHasher sip_hasher{fuzzed_data_provider.ConsumeIntegral<uint64_t>(), fuzzed_data_provider.ConsumeIntegral<uint64_t>()};
|
||||
|
||||
while (fuzzed_data_provider.ConsumeBool()) {
|
||||
while (--limit_max_ops >= 0 && fuzzed_data_provider.ConsumeBool()) {
|
||||
CallOneOf(
|
||||
fuzzed_data_provider,
|
||||
[&] {
|
||||
|
Loading…
Reference in New Issue
Block a user