Skip to content

Commit

Permalink
Enable AFL_SHA1_FILENAMES by default
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Sep 5, 2024
1 parent 02f21b6 commit 90dee6b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# test-fuzz

**News:** `cargo-test-fuzz` 5.3.0 enables [`AFL_SHA1_FILENAMES`] by default. If this causes you problems, please [open an issue], and reinstall `cargo-test-fuzz` with `--no-default-features`.

---

`test-fuzz` is a Cargo subcommand and a collection of Rust macros to automate certain tasks related to fuzzing with [`afl.rs`], including:

- generating a fuzzing corpus
Expand Down Expand Up @@ -512,6 +516,7 @@ These options are incompatible in the following sense. If a fuzz target's argume
[Substrate externalities]: https://substrate.dev/docs/en/knowledgebase/runtime/tests#mock-runtime-storage
[The Cargo Book]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#choosing-features
[Tips and tricks]: #tips-and-tricks
[`AFL_SHA1_FILENAMES`]: https://github.com/AFLplusplus/AFLplusplus/blob/stable/docs/env_variables.md
[`Clone`]: https://doc.rust-lang.org/std/clone/trait.Clone.html
[`Path`]: https://doc.rust-lang.org/std/path/struct.Path.html
[`TEST_FUZZ_MANIFEST_PATH`]: #test_fuzz_manifest_path
Expand Down Expand Up @@ -549,5 +554,6 @@ These options are incompatible in the following sense. If a fuzz target's argume
[conversion.rs]: https://github.com/trailofbits/test-fuzz/blob/master/examples/tests/conversion.rs#L5
[deriving them]: https://serde.rs/derive.html
[is not enabled]: https://github.com/rust-lang/rust/issues/45599#issuecomment-460488107
[open an issue]: https://github.com/trailofbits/test-fuzz/issues
[patch]: https://doc.rust-lang.org/edition-guide/rust-2018/cargo-and-crates-io/replacing-dependencies-with-patch.html
[won't allow you to]: https://doc.rust-lang.org/book/ch19-03-advanced-traits.html#using-the-newtype-pattern-to-implement-external-traits-on-external-types
2 changes: 2 additions & 0 deletions cargo-test-fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ xshell = { workspace = true }
testing = { workspace = true }

[features]
default = ["sha1-filenames"]
sha1-filenames = []
test-install = []

[lints]
Expand Down
3 changes: 3 additions & 0 deletions cargo-test-fuzz/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,9 @@ fn fuzz_command(
if opts.run_until_crash {
envs.push(("AFL_BENCH_UNTIL_CRASH", "1"));
}
if cfg!(feature = "sha1-filenames") {
envs.push(("AFL_SHA1_FILENAMES", "1"));
}

// smoelius: Passing `-c-` disables the cmplog fork server. Use of cmplog with a target that
// spawns subprocesses (like libtest does) can leave orphan processes running. This can cause
Expand Down

0 comments on commit 90dee6b

Please sign in to comment.