diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-06-17 10:49:17 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-06-17 10:32:59 +0200 |
commit | fa483e9f68b8b4171dabb25cc88dc2eada454a99 (patch) | |
tree | ae1ae2ab6fac47548b3f5ec601fc50e59d294086 /src/test/fuzz/crypto.cpp | |
parent | dd24567a243fd71ab2fe991b431f805bcc3f7b3e (diff) |
fuzz: Speed up crypto fuzz target
Diffstat (limited to 'src/test/fuzz/crypto.cpp')
-rw-r--r-- | src/test/fuzz/crypto.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/test/fuzz/crypto.cpp b/src/test/fuzz/crypto.cpp index eeeac18968..f83747e424 100644 --- a/src/test/fuzz/crypto.cpp +++ b/src/test/fuzz/crypto.cpp @@ -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, [&] { |