diff options
author | Andrew Poelstra <apoelstra@wpsoftware.net> | 2021-10-25 19:48:22 +0000 |
---|---|---|
committer | Andrew Poelstra <apoelstra@wpsoftware.net> | 2021-11-12 19:51:55 +0000 |
commit | 214d9055acdd72189a2f415477ce472ca8db4191 (patch) | |
tree | ceb70a5558b22371e5c3c4eddb11e967c4249192 /src/test/fuzz/addrman.cpp | |
parent | 22a90186496aea8025316bc5616905ffcf1aeb29 (diff) | |
download | bitcoin-214d9055acdd72189a2f415477ce472ca8db4191.tar.xz |
fuzz: replace every fuzzer-controlled loop with a LIMITED_WHILE loop
Blindly chose a cap of 10000 iterations for every loop, except for
the two in script_ops.cpp and scriptnum_ops.cpp which appeared to
(sometimes) be deserializing individual bytes; capped those to one
million to ensure that sometimes we try working with massive scripts.
There was also one fuzzer-controlled loop in timedata.cpp which was
already capped, so I left that alone.
git grep 'while (fuzz' should now run clean except for timedata.cpp
Diffstat (limited to 'src/test/fuzz/addrman.cpp')
-rw-r--r-- | src/test/fuzz/addrman.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/fuzz/addrman.cpp b/src/test/fuzz/addrman.cpp index c6df6a0e61..d427d12a3c 100644 --- a/src/test/fuzz/addrman.cpp +++ b/src/test/fuzz/addrman.cpp @@ -236,7 +236,7 @@ FUZZ_TARGET_INIT(addrman, initialize_addrman) } } AddrManDeterministic& addr_man = *addr_man_ptr; - while (fuzzed_data_provider.ConsumeBool()) { + LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) { CallOneOf( fuzzed_data_provider, [&] { @@ -247,7 +247,7 @@ FUZZ_TARGET_INIT(addrman, initialize_addrman) }, [&] { std::vector<CAddress> addresses; - while (fuzzed_data_provider.ConsumeBool()) { + LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) { const std::optional<CAddress> opt_address = ConsumeDeserializable<CAddress>(fuzzed_data_provider); if (!opt_address) { break; |