fuzz: Use LIMITED_WHILE instead of limit_max_ops

This commit is contained in:
MarcoFalke
2021-08-21 19:34:13 +02:00
parent f5a406f003
commit faa5fa9a78
6 changed files with 19 additions and 30 deletions

View File

@@ -206,14 +206,11 @@ 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 (--limit_max_ops >= 0 && prov.remaining_bytes()) {
LIMITED_WHILE(prov.remaining_bytes(), 3000)
{
switch (prov.ConsumeIntegralInRange<int>(0, 13 + 3 * (test.size() > 0))) {
case 0:
test.insert(prov.ConsumeIntegralInRange<size_t>(0, test.size()), prov.ConsumeIntegral<int>());