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
Multiple changes; python 2 support, dictionary, mutator refactor #26
Changes from 1 commit
9aa183f
a7b7264
d685d2d
895ee2f
ef2e1cf
acc996f
3a6fac5
b0cd504
ae27ac9
faa8e5f
beb0ce3
ecebfff
26d1e0e
0f78a24
6daa2b5
File filter...
Jump to…
Replaced infinite mutation loop with bounded loop.
Previously there was always a likelihood that we would terminate our retries if the mutator said that it was unable to be used, because we had a number of mutators that were unconditional. However, now that the mutators are able to be filtered, it is possible to select a set of mutators which may always claim they are inappropriate. In such a case, we would loop forever. This change bounds the retries on looking for a mutator to 20 attempts - an arbitrary number I picked from the air as seeming reasonable.
- Loading branch information
| @@ -459,7 +459,9 @@ def mutate(self, buf): | ||
| for i in range(nm): | ||
|
|
||
| # Select a mutator from those we can apply | ||
| while True: | ||
| # We'll try up to 20 times, but if we don't find a | ||
| # suitable mutator after that, we'll just give up. | ||
| for n in range(20): | ||
gerph
Author
Contributor
|
||
| x = self._rand(len(self.mutators)) | ||
| mutator = self.mutators[x] | ||
|
|
||
why change to 20 instead of the nm?
nm = self._rand_exp()was a magic number used both in go-fuzz and afl/libfuzzer and it worked well. I tried other numbers and it usually affected the speed of the fuzzer significantly