Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion centipede/centipede_flags.inc
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,9 @@ CENTIPEDE_FLAG(
std::string, fuzztest_configuration, "",
"If set, deserializes the FuzzTest configuration from the value as a "
"base64url string instead of querying the configuration via runner "
"callbacks. For FuzzTest framework only, do not use from end-users.")
"callbacks. Specially, if set to `(null)`, assumes no configuration "
"without querying the runner. For FuzzTest framework only, do not use from "
"end-users.")
CENTIPEDE_FLAG(
bool, list_crash_ids, false,
"If set, lists the crash IDs of a single test of the binary to the "
Expand Down
10 changes: 8 additions & 2 deletions centipede/centipede_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,9 @@ int CentipedeMain(const Environment& env,
// TODO: b/410051414 Use Centipede flags to pass necessary information
// instead of passing the entirely serialized Configuration once switched
// to the unified execution model.
if (!env.fuzztest_configuration.empty()) {
if (env.fuzztest_configuration == "(null)") {
return "";
} else if (!env.fuzztest_configuration.empty()) {
std::string result;
FUZZTEST_CHECK(
absl::WebSafeBase64Unescape(env.fuzztest_configuration, &result));
Expand All @@ -775,7 +777,11 @@ int CentipedeMain(const Environment& env,
}();
Environment updated_env = env;
if (updated_env.fuzztest_corpus_database.empty()) {
FUZZTEST_CHECK_OK(serialized_target_config.status());
if (!serialized_target_config.ok()) {
FUZZTEST_LOG(ERROR) << "Failed to get the serialized target config: "
<< serialized_target_config.status();
return EXIT_FAILURE;
}
if (!serialized_target_config->empty()) {
const auto target_config =
fuzztest::internal::Configuration::Deserialize(
Expand Down
19 changes: 11 additions & 8 deletions fuzztest/internal/centipede_adaptor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ fuzztest::internal::Environment CreateCentipedeEnvironmentFromConfiguration(
std::string{test_name}};
single_test_configuration.time_limit = total_time_limit;
single_test_configuration.time_budget_type = TimeBudgetType::kTotal;
env.fuzztest_configuration =
absl::WebSafeBase64Escape(single_test_configuration.Serialize());
env.UpdateWithTargetConfig(single_test_configuration);
env.fuzztest_configuration = "(null)";
}

absl::StrAppend(&env.binary,
Expand Down Expand Up @@ -390,6 +390,8 @@ void InstallCentipedeTerminationHandler() {

int RunCentipede(const Environment& env,
const std::optional<std::string>& centipede_command) {
FUZZTEST_CHECK(!IsCentipedeRunner())
<< "Unexpected RunCentipede() in runner mode.";
if (Runtime::instance().termination_requested()) {
absl::FPrintF(GetStderr(),
"Not running Centipede due to termination requested - "
Expand Down Expand Up @@ -908,11 +910,6 @@ bool CentipedeFuzzerAdaptor::Run(int* argc, char*** argv, RunMode mode,
CentipedeSetFailureDescription(std::string{crash_type}.c_str());
});
}
if (!configuration.corpus_database.empty() &&
configuration.crashing_input_to_reproduce.has_value() &&
configuration.replay_in_single_process) {
return ReplayCrashInSingleProcess(configuration);
}
if (runner_mode) {
std::optional<int> result;
fuzzer_impl_.fixture_driver_->RunFuzzTest([&, this]() {
Expand All @@ -928,7 +925,13 @@ bool CentipedeFuzzerAdaptor::Run(int* argc, char*** argv, RunMode mode,
FUZZTEST_CHECK(result.has_value())
<< "No result is set for running fuzz test";
return *result == EXIT_SUCCESS;
} else if (is_running_property_function_in_this_process) {
}
if (!configuration.corpus_database.empty() &&
configuration.crashing_input_to_reproduce.has_value() &&
configuration.replay_in_single_process) {
return ReplayCrashInSingleProcess(configuration);
}
if (is_running_property_function_in_this_process) {
// If `is_running_property_function_in_this_process` holds at this point. We
// assume it is for `ReplayInputsIfAvailable` to handle `FUZZTEST_REPLAY`
// and `FUZZTEST_MINIMIZE_REPRODUCER`, which Centipede does not support.
Expand Down
Loading