Skip to content

Commit faafda2

Browse files
author
MarcoFalke
committed
fuzz: Speed up prevector fuzz target
1 parent 531c2b7 commit faafda2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/test/fuzz/prevector.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,14 @@ class prevector_tester
206206

207207
FUZZ_TARGET(prevector)
208208
{
209+
// Pick an arbitrary upper bound to limit the runtime and avoid timeouts on
210+
// inputs.
211+
int limit_max_ops{3000};
212+
209213
FuzzedDataProvider prov(buffer.data(), buffer.size());
210214
prevector_tester<8, int> test;
211215

212-
while (prov.remaining_bytes()) {
216+
while (--limit_max_ops >= 0 && prov.remaining_bytes()) {
213217
switch (prov.ConsumeIntegralInRange<int>(0, 13 + 3 * (test.size() > 0))) {
214218
case 0:
215219
test.insert(prov.ConsumeIntegralInRange<size_t>(0, test.size()), prov.ConsumeIntegral<int>());

0 commit comments

Comments
 (0)