1#!/usr/bin/env bash 2set -e 3 4export CC=${CC:-cc} 5 6BROTLI="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )" 7SRC=$BROTLI/c 8 9cd $BROTLI 10 11rm -rf bin 12mkdir bin 13cd bin 14 15cmake $BROTLI -DCMAKE_C_COMPILER="$CC" \ 16 -DBUILD_TESTING=OFF -DENABLE_SANITIZER=address 17make -j$(nproc) brotlidec-static 18 19${CC} -o run_decode_fuzzer -std=c99 -fsanitize=address -I$SRC/include \ 20 $SRC/fuzz/decode_fuzzer.c $SRC/fuzz/run_decode_fuzzer.c \ 21 ./libbrotlidec-static.a ./libbrotlicommon-static.a 22 23mkdir decode_corpora 24unzip $BROTLI/java/org/brotli/integration/fuzz_data.zip -d decode_corpora 25 26for f in `ls decode_corpora` 27do 28 echo "Testing $f" 29 ./run_decode_fuzzer decode_corpora/$f 30done 31 32cd $BROTLI 33rm -rf bin 34