diff --git a/libafl_targets/src/libfuzzer.c b/libafl_targets/src/libfuzzer.c index ff6e2968ee..70df4f1132 100644 --- a/libafl_targets/src/libfuzzer.c +++ b/libafl_targets/src/libfuzzer.c @@ -1,5 +1,8 @@ #include "common.h" #include +#include +#include + #ifdef __APPLE__ #include #else @@ -18,6 +21,8 @@ EXT_FUNC(LLVMFuzzerCustomCrossOver, size_t, false); EXT_FUNC_IMPL(LLVMFuzzerTestOneInput, int, (const uint8_t *Data, size_t Size), false) { + fprintf(stderr, "Weakly defined \"LLVMFuzzerTestOneInput\" is linked. Did you add extern \"C\" to your harness?\n"); + abort(); return 0; } diff --git a/scripts/fmt_all.sh b/scripts/fmt_all.sh index 8bd22275cb..5119c53477 100755 --- a/scripts/fmt_all.sh +++ b/scripts/fmt_all.sh @@ -4,7 +4,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" LIBAFL_DIR=$(realpath "$SCRIPT_DIR/..") if [ "$1" = "check" ]; then - cargo run --manifest-path "$LIBAFL_DIR/utils/libafl_fmt/Cargo.toml" --release -- -c + cargo run --manifest-path "$LIBAFL_DIR/utils/libafl_fmt/Cargo.toml" --release -- -c --verbose else - cargo run --manifest-path "$LIBAFL_DIR/utils/libafl_fmt/Cargo.toml" --release + cargo run --manifest-path "$LIBAFL_DIR/utils/libafl_fmt/Cargo.toml" --release -- --verbose fi diff --git a/utils/libafl_fmt/src/main.rs b/utils/libafl_fmt/src/main.rs index 0e85fde97b..f2f480f8f1 100644 --- a/utils/libafl_fmt/src/main.rs +++ b/utils/libafl_fmt/src/main.rs @@ -31,7 +31,7 @@ async fn run_cargo_fmt(path: PathBuf, is_check: bool, verbose: bool) -> io::Resu let res = fmt_command.output().await?; if !res.status.success() { - println!("{}", from_utf8(&res.stdout).unwrap()); + println!("{}", from_utf8(&res.stderr).unwrap()); return Err(io::Error::new(ErrorKind::Other, "Cargo fmt failed.")); } @@ -96,6 +96,7 @@ async fn main() -> io::Result<()> { r".*utils/gdb_qemu.*", r".*docs/listings/baby_fuzzer/listing-.*", r".*LibAFL/Cargo.toml.*", + r".*AFLplusplus.*", ]) .expect("Could not create the regex set from the given regex"); @@ -105,6 +106,7 @@ async fn main() -> io::Result<()> { r".*stb_image\.h$", r".*dlmalloc\.c$", r".*QEMU-Nyx.*", + r".*AFLplusplus.*", ]) .expect("Could not create the regex set from the given regex");