2016-12-09 07:58:13 +00:00
|
|
|
#!/usr/bin/env bash
|
2017-09-26 11:49:30 +00:00
|
|
|
set -e
|
2016-12-08 11:55:18 +00:00
|
|
|
|
2017-09-26 11:49:30 +00:00
|
|
|
export CC=${CC:-cc}
|
|
|
|
|
|
|
|
BROTLI="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
|
|
|
|
SRC=$BROTLI/c
|
2016-12-08 11:55:18 +00:00
|
|
|
|
|
|
|
cd $BROTLI
|
|
|
|
|
|
|
|
rm -rf bin
|
|
|
|
mkdir bin
|
|
|
|
cd bin
|
|
|
|
|
2018-06-18 12:39:38 +00:00
|
|
|
cmake $BROTLI -DCMAKE_C_COMPILER="$CC" \
|
2017-09-26 11:49:30 +00:00
|
|
|
-DBUILD_TESTING=OFF -DENABLE_SANITIZER=address
|
|
|
|
make -j$(nproc) brotlidec-static
|
2016-12-08 11:55:18 +00:00
|
|
|
|
2018-06-18 12:39:38 +00:00
|
|
|
${CC} -o run_decode_fuzzer -std=c99 -fsanitize=address -I$SRC/include \
|
|
|
|
$SRC/fuzz/decode_fuzzer.c $SRC/fuzz/run_decode_fuzzer.c \
|
2017-09-26 11:49:30 +00:00
|
|
|
./libbrotlidec-static.a ./libbrotlicommon-static.a
|
2016-12-08 11:55:18 +00:00
|
|
|
|
|
|
|
mkdir decode_corpora
|
2017-09-26 11:49:30 +00:00
|
|
|
unzip $BROTLI/java/org/brotli/integration/fuzz_data.zip -d decode_corpora
|
2016-12-08 11:55:18 +00:00
|
|
|
|
|
|
|
for f in `ls decode_corpora`
|
|
|
|
do
|
|
|
|
echo "Testing $f"
|
|
|
|
./run_decode_fuzzer decode_corpora/$f
|
|
|
|
done
|
|
|
|
|
|
|
|
cd $BROTLI
|
|
|
|
rm -rf bin
|