[libidn2] Fuzzing integration improved (#736)

This commit is contained in:
Tim Rühsen 2017-07-25 16:50:23 +02:00 committed by Oliver Chang
parent 621b2d4153
commit a5c9395ddd
2 changed files with 14 additions and 23 deletions

View File

@ -15,11 +15,10 @@
################################################################################
FROM gcr.io/oss-fuzz-base/base-builder
MAINTAINER n.mavrogiannopoulos@gmail.com
MAINTAINER rockdaboot@gmail.com
RUN apt-get update && apt-get install -y make autoconf automake gettext libtool autopoint pkg-config gengetopt curl gperf
RUN git clone --depth=1 https://gitlab.com/libidn/libidn2.git
RUN cd libidn2 && git submodule update --init
RUN git clone --depth=1 --recursive https://gitlab.com/libidn/libidn2.git
WORKDIR libidn2
COPY build.sh $SRC/

View File

@ -16,26 +16,18 @@
################################################################################
./bootstrap
./configure --enable-static --disable-doc
make "-j$(nproc)" -C unistring
make "-j$(nproc)" -C gl
make "-j$(nproc)" -C lib
# switch off leak detection for ./configure run to detect iconv() correctly
ASAN_OPTIONS=detect_leaks=0 ./configure --enable-static --disable-shared --disable-doc --disable-gcc-warnings
make clean
make -j$(nproc) check
fuzzers=$(find fuzz/ -name "*_fuzzer.cc")
cd fuzz
make oss-fuzz
find . -name '*_fuzzer' -exec cp -v '{}' $OUT ';'
find . -name '*_fuzzer.dict' -exec cp -v '{}' $OUT ';'
find . -name '*_fuzzer.options' -exec cp -v '{}' $OUT ';'
for f in $fuzzers; do
fuzzer=$(basename "$f" ".cc")
$CXX $CXXFLAGS -std=c++11 -Ilib/ \
"fuzz/${fuzzer}.cc" -o "$OUT/${fuzzer}" \
lib/.libs/libidn2.a -lFuzzingEngine -Wl,-Bstatic \
-Wl,-Bdynamic
if [ -f "$SRC/${fuzzer}_seed_corpus.zip" ]; then
cp "$SRC/${fuzzer}_seed_corpus.zip" "$OUT/"
fi
corpus_dir=$(basename "${fuzzer}" "_fuzzer")
if [ -d "fuzz/${corpus_dir}.in/" ]; then
zip -r "$OUT/${fuzzer}_seed_corpus.zip" "fuzz/${corpus_dir}.in/"
fi
for dir in *_fuzzer.in; do
fuzzer=$(basename $dir .in)
zip -rj "$OUT/${fuzzer}_seed_corpus.zip" "${dir}/"
done