diff --git a/projects/libidn2/Dockerfile b/projects/libidn2/Dockerfile index f0671f2e7..193fc16a1 100644 --- a/projects/libidn2/Dockerfile +++ b/projects/libidn2/Dockerfile @@ -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/ diff --git a/projects/libidn2/build.sh b/projects/libidn2/build.sh index f623ce5a5..7a1e1a48e 100755 --- a/projects/libidn2/build.sh +++ b/projects/libidn2/build.sh @@ -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