From 214d9055acdd72189a2f415477ce472ca8db4191 Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Mon, 25 Oct 2021 19:48:22 +0000 Subject: 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 --- src/test/fuzz/pow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/test/fuzz/pow.cpp') diff --git a/src/test/fuzz/pow.cpp b/src/test/fuzz/pow.cpp index 47b4323e81..1123c8c170 100644 --- a/src/test/fuzz/pow.cpp +++ b/src/test/fuzz/pow.cpp @@ -27,7 +27,7 @@ FUZZ_TARGET_INIT(pow, initialize_pow) std::vector blocks; const uint32_t fixed_time = fuzzed_data_provider.ConsumeIntegral(); const uint32_t fixed_bits = fuzzed_data_provider.ConsumeIntegral(); - while (fuzzed_data_provider.remaining_bytes() > 0) { + LIMITED_WHILE(fuzzed_data_provider.remaining_bytes() > 0, 10000) { const std::optional block_header = ConsumeDeserializable(fuzzed_data_provider); if (!block_header) { continue; -- cgit v1.2.3