Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 693412316
  • Loading branch information
xinhaoyuan authored and copybara-github committed Nov 5, 2024
1 parent 4e8f47b commit d213ca2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
9 changes: 7 additions & 2 deletions centipede/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1022,13 +1022,18 @@ RUNNER_SOURCES_NO_MAIN = [

RUNNER_SOURCES_WITH_MAIN = RUNNER_SOURCES_NO_MAIN + ["runner_main.cc"]

RUNNER_FUZZTEST_COPTS = select({
"@com_google_fuzztest//fuzztest:use_centipede": ["-DCENTIPEDE_RUNNER_NO_MUTATE_LIB"],
"//conditions:default": [],
})

# Disable sancov and sanitizer instrumentation
RUNNER_COPTS = [
RUNNER_COPTS = RUNNER_FUZZTEST_COPTS + [
"-fsanitize-coverage=0",
"-fno-sanitize=address,hwaddress,memory,thread,undefined",
]

RUNNER_SANITIZED_COPTS = [
RUNNER_SANITIZED_COPTS = RUNNER_FUZZTEST_COPTS + [
"-fsanitize-coverage=0",
]

Expand Down
2 changes: 2 additions & 0 deletions centipede/runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ void GlobalRunnerState::ResetTimers() {
}
}

#ifndef CENTIPEDE_RUNNER_NO_MUTATE_LIB
// Byte array mutation fallback for a custom mutator, as defined here:
// https://github.com/google/fuzzing/blob/master/docs/structure-aware-fuzzing.md
extern "C" size_t LLVMFuzzerMutate(uint8_t *data, size_t size,
Expand All @@ -352,6 +353,7 @@ extern "C" size_t LLVMFuzzerMutate(uint8_t *data, size_t size,
memcpy(data, array.data(), array.size());
return array.size();
}
#endif // CENTIPEDE_RUNNER_NO_MUTATE_LIB

// An arbitrary large size for input data.
static const size_t kMaxDataSize = 1 << 20;
Expand Down
7 changes: 0 additions & 7 deletions fuzztest/llvm_fuzzer_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
#include "./fuzztest/internal/domains/container_of_impl.h"
#include "./fuzztest/internal/domains/domain_base.h"
#include "./fuzztest/internal/io.h"
#ifndef FUZZTEST_USE_CENTIPEDE
#include "./fuzztest/internal/coverage.h"
#endif

ABSL_DECLARE_FLAG(std::string, llvm_fuzzer_wrapper_dict_file);
ABSL_DECLARE_FLAG(std::string, llvm_fuzzer_wrapper_corpus_dir);
Expand Down Expand Up @@ -127,9 +125,6 @@ class InplaceVector {
std::size_t size_;
};

// Centipede runner also provides LLVMFuzzerMutate to support libFuzzer targets
// on its own. So we do not define it when integrating with Centipede.
#ifndef FUZZTEST_USE_CENTIPEDE

extern "C" size_t LLVMFuzzerMutate(uint8_t* data, size_t size,
size_t max_size) {
Expand All @@ -147,8 +142,6 @@ extern "C" size_t LLVMFuzzerMutate(uint8_t* data, size_t size,
return val.size();
}

#endif

class ArbitraryByteVector
: public fuzztest::internal::SequenceContainerOfImpl<
std::vector<uint8_t>, fuzztest::internal::ArbitraryImpl<uint8_t>> {
Expand Down

0 comments on commit d213ca2

Please sign in to comment.