Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the coprus initialization out of a hot path #47

Open
wants to merge 1 commit into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Move the coprus initialization out of a hot path

This initial corpus seeding can be done in the constructor,
instead of checking if it has been initialized every single time
the fuzzer generates an input.
  • Loading branch information
jvoisin committed Jun 10, 2020
commit e806f3b7346e37315c8e6698b13a18659a767e18
@@ -412,6 +412,7 @@ def __init__(self, dirs=None, max_input_size=4096, mutators_filter=None, dict_pa
self._seed_run_finished = not self._inputs
self._seed_idx = 0
self._save_corpus = dirs and os.path.isdir(dirs[0])
self._inputs.append(bytearray(0))

# Work out what we'll filter
filters = mutators_filter.split(' ') if mutators_filter else []
@@ -488,13 +489,8 @@ def generate_input(self):
self._seed_run_finished = True
return next_input

if len(self._inputs) == 0:
zero_test_case = bytearray(0)
self.put(zero_test_case)
return zero_test_case
else:
buf = self._inputs[self._rand(len(self._inputs))]
return self.mutate(buf)
buf = self._inputs[self._rand(len(self._inputs))]
return self.mutate(buf)

def mutate(self, buf):
res = buf[:]
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.