From d5b1a4f0958c860e825bfd5827cb985a4b86147d Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 27 Oct 2023 21:04:32 -0700 Subject: [PATCH] fuzz.sh: add --max-len option --- tools/libFuzzer/fuzz.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/libFuzzer/fuzz.sh b/tools/libFuzzer/fuzz.sh index 94bd5a95..ad7e5e9b 100755 --- a/tools/libFuzzer/fuzz.sh +++ b/tools/libFuzzer/fuzz.sh @@ -18,6 +18,7 @@ Fuzz wimlib with LLVM's libFuzzer. Options: --asan Enable AddressSanitizer --input=INPUT Test a single input file only + --max-len=LEN Maximum length of generated inputs (default: $MAX_LEN) --msan Enable MemorySanitizer --time=SECONDS Stop after the given time has passed --ubsan Enable UndefinedBehaviorSanitizer @@ -39,13 +40,15 @@ run_cmd() } EXTRA_SANITIZERS= -EXTRA_FUZZER_ARGS=('-max_len=32768') +EXTRA_FUZZER_ARGS=() INPUT= +MAX_LEN=32768 longopts_array=( asan help input: +max-len: msan time: ubsan @@ -70,13 +73,17 @@ while true; do INPUT=$2 shift ;; - --time) - EXTRA_FUZZER_ARGS+=("-max_total_time=$2") + --max-len) + MAX_LEN=$2 shift ;; --msan) EXTRA_SANITIZERS+=",memory" ;; + --time) + EXTRA_FUZZER_ARGS+=("-max_total_time=$2") + shift + ;; --ubsan) EXTRA_SANITIZERS+=",undefined" ;; @@ -91,6 +98,7 @@ while true; do esac shift done +EXTRA_FUZZER_ARGS+=("-max_len=$MAX_LEN") if (( $# != 1 )); then echo 1>&2 "No fuzz target specified!" -- 2.46.1