Skip to content

Commit

Permalink
Require cargo-afl version for add-seeds, and update some dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
louismerlin committed Nov 20, 2023
1 parent 79294cd commit 5960cc6
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 54 deletions.
105 changes: 53 additions & 52 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ members = [
]

[dependencies]
afl = { version = "0.14.1", default-features = false, optional = true }
afl = { version = "0.14.5", default-features = false, optional = true }
anyhow = { version = "1.0.75", optional = true }
cargo_metadata = { version = "0.18.0", optional = true }
clap = { version = "4.4.6", features = ["cargo", "derive", "env"], optional = true }
clap = { version = "4.4.8", features = ["cargo", "derive", "env"], optional = true }
console = { version = "0.15.7", optional = true }
env_logger = { version = "0.10.0", optional = true }
fork = { version = "0.1.22", optional = true }
Expand All @@ -28,6 +28,7 @@ honggfuzz = { package = "ziggy-honggfuzz-2", version = "0.5.55", optional = true
libc = { version = "0.2.147", optional = true }
log = { version = "0.4.20", optional = true }
rand = { version = "0.8", optional = true }
semver = "1.0"
serde_json = { version = "1.0.105", optional = true }
strip-ansi-escapes = { version = "0.2.0", optional = true }
time-humanize = { version = "0.1.3", optional = true }
Expand Down
19 changes: 19 additions & 0 deletions src/bin/cargo-ziggy/add_seeds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ impl AddSeeds {
pub fn add_seeds(&mut self) -> Result<(), anyhow::Error> {
eprintln!("Adding seeds to AFL");

let req = semver::VersionReq::parse(">=0.14.5").unwrap();
let cargo = env::var("CARGO").unwrap_or_else(|_| String::from("cargo"));
let afl_version = process::Command::new(cargo)
.args(["afl", "--version"])
.output()
.context("could not run `cargo afl --version`")?;

if !std::str::from_utf8(afl_version.stdout.as_slice())
.unwrap_or_default()
.split_whitespace()
.nth(1)
.context("could not get afl version from stdout")
.map(semver::Version::parse)
.context("could not parse cargo-afl version")?
.map(|v| req.matches(&v))?
{
return Err(anyhow!("Outdated version of cargo-afl, ziggy needs >=0.14.5, please run `cargo install cargo-afl`"));
}

self.target = find_target(&self.target)?;

let input = self
Expand Down

0 comments on commit 5960cc6

Please sign in to comment.