diff --git a/src/Fuzzer.php b/src/Fuzzer.php index c593bcd..7db32e6 100644 --- a/src/Fuzzer.php +++ b/src/Fuzzer.php @@ -333,22 +333,24 @@ private function minimizeCrash(string $path) { } while ($this->runs < $this->maxRuns) { - // TODO: Mutation depth, etc. - $newInput = $this->mutator->mutate($input, $this->maxLen, null); - if (\strlen($newInput) >= \strlen($input)) { - continue; - } + $newInput = $input; + for ($m = 0; $m < $this->mutationDepthLimit; $m++) { + $newInput = $this->mutator->mutate($newInput, $this->maxLen, null); + if (\strlen($newInput) >= \strlen($input)) { + continue; + } - $newEntry = $this->runInput($newInput); - if (!$newEntry->crashInfo) { - continue; - } + $newEntry = $this->runInput($newInput); + if (!$newEntry->crashInfo) { + continue; + } - $newEntry->storeAtPath(getcwd() . '/minimized-' . md5($newInput) . '.txt'); + $newEntry->storeAtPath(getcwd() . '/minimized-' . md5($newInput) . '.txt'); - $len = \strlen($newInput); - $this->printCrash("CRASH with length $len", $newEntry); - $input = $newInput; + $len = \strlen($newInput); + $this->printCrash("CRASH with length $len", $newEntry); + $input = $newInput; + } } }