From fde0d50ec266fa85f872e40c9ddb84ea05cfeb3e Mon Sep 17 00:00:00 2001 From: Joe Ranweiler Date: Tue, 8 Feb 2022 00:21:29 +0000 Subject: [PATCH] Force `-runs=1` when invoking in repro mode --- src/agent/onefuzz/src/libfuzzer.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/agent/onefuzz/src/libfuzzer.rs b/src/agent/onefuzz/src/libfuzzer.rs index bddab1203c..29973ab6cb 100644 --- a/src/agent/onefuzz/src/libfuzzer.rs +++ b/src/agent/onefuzz/src/libfuzzer.rs @@ -171,6 +171,15 @@ impl<'a> LibFuzzer<'a> { // good input, which libfuzzer works as we expect. let mut cmd = self.build_command(None, None, None).await?; + + // Override any arg of the form `-runs=` (last occurrence wins). + // In this command invocation, we only ever want to test inputs once. + // + // Assumes that the presence of an `-args` option was an iteration limit meant + // for fuzzing mode. We are only mutating the args of a local `Command`, so the + // command used by the `fuzz()` method will still receive the iteration limit. + cmd.arg("-runs=1"); + cmd.arg(&input); let result = cmd