Skip to content

Commit

Permalink
#Centipede Always load any seed inputs from the target.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 679578077
  • Loading branch information
xinhaoyuan authored and copybara-github committed Sep 27, 2024
1 parent 911cd9c commit 9bca69d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion centipede/centipede.cc
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,11 @@ void Centipede::FuzzingLoop() {
auto features_file = DefaultBlobFileWriterFactory(env_.riegeli);
CHECK_OK(features_file->Open(features_path, "a"));

LoadSeedInputs(corpus_file.get(), features_file.get());
// Load seed corpus when there is no external corpus loaded.
if (corpus_.NumTotal() == 0) {
LoadSeedInputs(corpus_file.get(), features_file.get());
}

UpdateAndMaybeLogStats("init-done", 0);

// If we're going to fuzz, dump the initial telemetry files. For a brand-new
Expand Down
4 changes: 2 additions & 2 deletions centipede/centipede_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ TEST(Centipede, ReadFirstCorpusDir) {
CentipedeMock mock_2(env);
MockFactory factory_2(mock_2);
CentipedeMain(env, factory_2);
// Should observe all inputs in corpus_dir, plus the seed input {0}.
EXPECT_EQ(mock_2.num_inputs_, 512 + 1);
// Should observe all inputs in corpus_dir.
EXPECT_EQ(mock_2.num_inputs_, 512);
}

TEST(Centipede, DoesNotReadFirstCorpusDirIfOutputOnly) {
Expand Down

0 comments on commit 9bca69d

Please sign in to comment.