mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-10 10:52:31 -05:00
fuzz: Speed up prevector fuzz target
This commit is contained in:
parent
531c2b7c04
commit
faafda232e
1 changed files with 5 additions and 1 deletions
|
@ -206,10 +206,14 @@ public:
|
||||||
|
|
||||||
FUZZ_TARGET(prevector)
|
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());
|
FuzzedDataProvider prov(buffer.data(), buffer.size());
|
||||||
prevector_tester<8, int> test;
|
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))) {
|
switch (prov.ConsumeIntegralInRange<int>(0, 13 + 3 * (test.size() > 0))) {
|
||||||
case 0:
|
case 0:
|
||||||
test.insert(prov.ConsumeIntegralInRange<size_t>(0, test.size()), prov.ConsumeIntegral<int>());
|
test.insert(prov.ConsumeIntegralInRange<size_t>(0, test.size()), prov.ConsumeIntegral<int>());
|
||||||
|
|
Loading…
Add table
Reference in a new issue