diff --git a/afl/src/lib.rs b/afl/src/lib.rs index 9d0e52848..836e83bc7 100644 --- a/afl/src/lib.rs +++ b/afl/src/lib.rs @@ -5,6 +5,7 @@ // you may not use this file except in compliance with the License. // See `LICENSE` in this repository. +use std::env; use std::io::{self, Read}; use std::panic; @@ -68,10 +69,18 @@ where let mut input = vec![]; + let loop_count = if let Ok(value) = env::var("AFL_FUZZER_LOOPCOUNT") { + value + .parse() + .expect("Failed to parse environment variable to a number") + } else { + usize::MAX + }; + // initialize forkserver there unsafe { __afl_manual_init() }; - while unsafe { __afl_persistent_loop(1000) } != 0 { + while unsafe { __afl_persistent_loop(loop_count) } != 0 { // get the testcase from the fuzzer let input_ref = if unsafe { __afl_fuzz_ptr.is_null() } { // in-memory testcase delivery is not enabled diff --git a/cargo-afl/AFLplusplus b/cargo-afl/AFLplusplus index 7e67dc9d6..ca0c9f6d1 160000 --- a/cargo-afl/AFLplusplus +++ b/cargo-afl/AFLplusplus @@ -1 +1 @@ -Subproject commit 7e67dc9d6938aadef19d5697a448cdf15a50172f +Subproject commit ca0c9f6d1797bac121996c3b2ac50423f6e67b8f