tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

fuzz.sh (958B)


      1 #!/usr/bin/env bash
      2 
      3 source $(dirname "$0")/tools.sh
      4 
      5 target="$1"
      6 corpus="$2"
      7 shift 2
      8 
      9 # Fetch artifact if needed.
     10 fetch_dist
     11 
     12 export DIST=${PWD}/dist
     13 
     14 cp -a "${VCS_PATH}/nss" .
     15 
     16 # Create and change to corpus directory.
     17 mkdir -p "nss/fuzz/corpus/$corpus"
     18 pushd "nss/fuzz/corpus/$corpus"
     19 
     20 # Fetch and unzip the public OSS-Fuzz corpus. Handle the case that there
     21 # may be no corpus yet for new fuzz targets.
     22 code=$(curl -w "%{http_code}" -O "https://storage.googleapis.com/nss-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/nss_$corpus/public.zip")
     23 if [[ $code -eq 200 ]]; then
     24    unzip public.zip
     25 fi
     26 rm -f public.zip
     27 
     28 # Change back to previous working directory.
     29 popd
     30 
     31 # Fetch objdir name.
     32 objdir=$(cat dist/latest)
     33 
     34 # Get libFuzzer options.
     35 readarray -t options < <(python3 nss/fuzz/config/libfuzzer_options.py nss/fuzz/options/"$corpus".options)
     36 
     37 # Run nssfuzz.
     38 dist/"$objdir"/bin/nssfuzz-"$target" "nss/fuzz/corpus/$corpus" "${options[@]}" "$@"