From aafe3a6dd3b0417ca988197c689865c9c8de480c Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Mon, 21 Sep 2020 15:30:39 +0100 Subject: [PATCH] libvips: add libheif and libaom as dependencies Allows fuzz testing of AVIF/HEIF inputs --- projects/libvips/Dockerfile | 3 +++ projects/libvips/build.sh | 38 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/projects/libvips/Dockerfile b/projects/libvips/Dockerfile index cd19864c41e8..258e222a47ca 100644 --- a/projects/libvips/Dockerfile +++ b/projects/libvips/Dockerfile @@ -36,5 +36,8 @@ RUN git clone --depth 1 https://github.com/glennrp/libpng.git RUN git clone --depth 1 https://git.code.sf.net/p/giflib/code libgif RUN git clone --depth 1 https://chromium.googlesource.com/webm/libwebp RUN git clone --depth 1 https://gitlab.com/libtiff/libtiff +RUN git clone --depth 1 https://aomedia.googlesource.com/aom +RUN git clone --depth 1 https://github.com/strukturag/libheif + WORKDIR libvips COPY build.sh $SRC/ diff --git a/projects/libvips/build.sh b/projects/libvips/build.sh index c34eadc6e084..e170f37149d1 100755 --- a/projects/libvips/build.sh +++ b/projects/libvips/build.sh @@ -16,6 +16,7 @@ ################################################################################ export PKG_CONFIG_PATH=/work/lib/pkgconfig +export LDFLAGS="$CXXFLAGS" # libz pushd $SRC/zlib @@ -36,6 +37,41 @@ make -j$(nproc) make install popd +# aom +pushd $SRC/aom +mkdir -p build/linux +cd build/linux +cmake -G "Unix Makefiles" \ + -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \ + -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ + -DCMAKE_INSTALL_PREFIX=$WORK -DCMAKE_INSTALL_LIBDIR=lib \ + -DENABLE_SHARED:bool=off -DCONFIG_PIC=1 \ + -DENABLE_EXAMPLES=0 -DENABLE_DOCS=0 -DENABLE_TESTS=0 \ + -DCONFIG_SIZE_LIMIT=1 \ + -DDECODE_HEIGHT_LIMIT=12288 -DDECODE_WIDTH_LIMIT=12288 \ + -DDO_RANGE_CHECK_CLAMP=1 \ + -DAOM_MAX_ALLOCABLE_MEMORY=536870912 \ + -DAOM_TARGET_CPU=generic \ + ../../ +make clean +make -j$(nproc) +make install +popd + +# libheif +pushd $SRC/libheif +autoreconf -fi +./configure \ + --disable-shared \ + --enable-static \ + --disable-examples \ + --disable-go \ + --prefix=$WORK +make clean +make -j$(nproc) +make install +popd + # libjpeg-turbo pushd $SRC/libjpeg-turbo cmake . -DCMAKE_INSTALL_PREFIX=$WORK -DENABLE_STATIC:bool=on @@ -128,6 +164,8 @@ for fuzzer in fuzz/*_fuzzer.cc; do $WORK/lib/libwebpdemux.a \ $WORK/lib/libwebp.a \ $WORK/lib/libtiff.a \ + $WORK/lib/libheif.a \ + $WORK/lib/libaom.a \ $LIB_FUZZING_ENGINE \ -Wl,-Bstatic \ -lfftw3 -lgmodule-2.0 -lgio-2.0 -lgobject-2.0 -lffi -lglib-2.0 -lpcre -lexpat \