diff options
author | 2017-07-06 16:45:40 +0200 | |
---|---|---|
committer | 2017-07-06 07:45:40 -0700 | |
commit | 2ad437bb360cacadd79de5d919972a587a15bbc4 (patch) | |
tree | d2e8cc12ebe34b9ea886de6847d63df9bfa38eed /projects/wget2 | |
parent | 90d02e761eca22aa47ecc89de7fbad8de35d032b (diff) |
[wget2] Fix building cookie fuzzer (#701)
Diffstat (limited to 'projects/wget2')
-rw-r--r-- | projects/wget2/Dockerfile | 28 | ||||
-rwxr-xr-x | projects/wget2/build.sh | 60 |
2 files changed, 73 insertions, 15 deletions
diff --git a/projects/wget2/Dockerfile b/projects/wget2/Dockerfile index 9cd25092..b81fde62 100644 --- a/projects/wget2/Dockerfile +++ b/projects/wget2/Dockerfile @@ -17,27 +17,31 @@ FROM gcr.io/oss-fuzz-base/base-builder MAINTAINER rockdaboot@gmail.com RUN apt-get update && apt-get install -y \ + make \ pkg-config \ gettext \ + autogen \ autopoint \ autoconf \ automake \ libtool \ texinfo \ flex \ - liblzma-dev \ - libidn11-dev \ - libidn2-0-dev \ - libunistring-dev \ - zlib1g-dev \ - libbz2-dev \ - gnutls-dev \ - libpsl-dev \ - libnghttp2-dev \ - doxygen + bison \ + gettext \ + gengetopt \ + curl \ + gperf \ + wget \ + python + +RUN git clone --depth=1 --recursive https://git.savannah.gnu.org/git/libunistring.git +RUN git clone --depth=1 --recursive https://gitlab.com/libidn/libidn2.git +RUN git clone --depth=1 --recursive https://github.com/rockdaboot/libpsl.git +RUN git clone --depth=1 https://git.lysator.liu.se/nettle/nettle.git +RUN git clone --depth=1 https://gitlab.com/gnutls/gnutls.git -RUN git clone --depth=1 https://gitlab.com/gnuwget/wget2.git -RUN cd wget2 && git submodule update --init +RUN git clone --depth=1 --recursive https://gitlab.com/gnuwget/wget2.git WORKDIR wget2 COPY build.sh $SRC/ diff --git a/projects/wget2/build.sh b/projects/wget2/build.sh index aaaf7499..a5246c0f 100755 --- a/projects/wget2/build.sh +++ b/projects/wget2/build.sh @@ -15,16 +15,70 @@ # ################################################################################ +export WGET2_DEPS_PATH=$SRC/wget2_deps +export PKG_CONFIG_PATH=$WGET2_DEPS_PATH/lib/pkgconfig +export CPPFLAGS="-I$WGET2_DEPS_PATH/include" +export LDFLAGS="-L$WGET2_DEPS_PATH/lib" + +cd $SRC/libunistring +./autogen.sh +./configure --enable-static --disable-shared --prefix=$WGET2_DEPS_PATH +make -j$(nproc) +make install + +cd $SRC/libidn2 +./bootstrap +./configure --enable-static --disable-shared --disable-doc --disable-gcc-warnings --prefix=$WGET2_DEPS_PATH +make -j$(nproc) +make install + +cd $SRC/libpsl +./autogen.sh +./configure --enable-static --disable-shared --disable-gtk-doc --enable-runtime=libidn2 --enable-builtin=libidn2 --prefix=$WGET2_DEPS_PATH +make -j$(nproc) +make install + +GNUTLS_CONFIGURE_FLAGS="" +NETTLE_CONFIGURE_FLAGS="" +if [[ $CFLAGS = *sanitize=memory* ]]; then + GNUTLS_CONFIGURE_FLAGS="--disable-hardware-acceleration" + NETTLE_CONFIGURE_FLAGS="--disable-assembler --disable-fat" +fi + +# We could use GMP from git repository to avoid false positives in +# sanitizers, but GMP doesn't compile with clang. We use gmp-mini +# instead. +cd $SRC/nettle +bash .bootstrap +./configure --enable-mini-gmp --enable-static --disable-shared --disable-documentation --prefix=$WGET2_DEPS_PATH $NETTLE_CONFIGURE_FLAGS +( make -j$(nproc) || make -j$(nproc) ) && make install +if test $? != 0;then + echo "Failed to compile nettle" + exit 1 +fi + +cd $SRC/gnutls +make bootstrap +LIBS="-lunistring" \ +./configure --with-nettle-mini --enable-gcc-warnings --enable-static --disable-shared --with-included-libtasn1 \ + --with-included-unistring --without-p11-kit --disable-doc --disable-tests --disable-tools --disable-cxx \ + --disable-maintainer-mode --disable-libdane --disable-gcc-warnings --prefix=$WGET2_DEPS_PATH $GNUTLS_CONFIGURE_FLAGS +make -j$(nproc) +make install + + # avoid iconv() memleak on Ubuntu 16.04 image (breaks test suite) export ASAN_OPTIONS=detect_leaks=0 -! test -f lib/Makefile.in && ./bootstrap -./configure --enable-static --disable-doc +cd $SRC/wget2 +./bootstrap +LIBS="-lgnutls -lnettle -lhogweed -lidn2 -lunistring" \ +./configure --enable-static --disable-shared --disable-doc --without-plugin-support make clean make -j$(nproc) all check cd fuzz -make oss-fuzz +CXXFLAGS="$CXXFLAGS -L$WGET2_DEPS_PATH/lib/" make oss-fuzz find . -name '*_fuzzer.dict' -exec cp -v '{}' $OUT ';' find . -name '*_fuzzer.options' -exec cp -v '{}' $OUT ';' |