diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-07-14 12:35:14 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-07-14 12:34:04 +0200 |
commit | faafda232e1d4f79ee64dbfee699a8018f25b0bc (patch) | |
tree | 3c247f3c9a445f3dd672cf30eb7ca3a52eef1f64 /src/test | |
parent | 531c2b7c04898f5a2097f44e8c12bfb2f53aaf9b (diff) |
fuzz: Speed up prevector fuzz target
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/fuzz/prevector.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/test/fuzz/prevector.cpp b/src/test/fuzz/prevector.cpp index 51956bbe9e..447f32ed16 100644 --- a/src/test/fuzz/prevector.cpp +++ b/src/test/fuzz/prevector.cpp @@ -206,10 +206,14 @@ public: FUZZ_TARGET(prevector) { + // Pick an arbitrary upper bound to limit the runtime and avoid timeouts on + // inputs. + int limit_max_ops{3000}; + FuzzedDataProvider prov(buffer.data(), buffer.size()); prevector_tester<8, int> test; - while (prov.remaining_bytes()) { + while (--limit_max_ops >= 0 && prov.remaining_bytes()) { switch (prov.ConsumeIntegralInRange<int>(0, 13 + 3 * (test.size() > 0))) { case 0: test.insert(prov.ConsumeIntegralInRange<size_t>(0, test.size()), prov.ConsumeIntegral<int>()); |