Skip to content

Commit

Permalink
Merge pull request #102 from kevin-valerio/fix-init-seed
Browse files Browse the repository at this point in the history
Adding init seed only if corpus directory is empty
  • Loading branch information
louismerlin authored Oct 14, 2024
2 parents fc29e02 + 98f44e9 commit 210c957
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/bin/cargo-ziggy/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,12 @@ impl Fuzz {
}

// We create an initial corpus file, so that AFL++ starts-up properly if corpus is empty
let mut initial_corpus = File::create(self.corpus() + "/init")?;
writeln!(&mut initial_corpus, "00000000")?;
drop(initial_corpus);
let is_empty = fs::read_dir(self.corpus())?.next().is_none(); // check if corpus has some seeds
if is_empty {
let mut initial_corpus = File::create(self.corpus() + "/init")?;
writeln!(&mut initial_corpus, "00000000")?;
drop(initial_corpus);
}

let mut processes = self.spawn_new_fuzzers()?;

Expand Down

0 comments on commit 210c957

Please sign in to comment.