aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Janne Grunau <janne-vlc@jannau.net>2019-09-12 21:29:02 +0200
committerGravatar jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>2019-09-12 12:29:02 -0700
commitf986fafb8eb24c9071f97eaa6e6726467755fca9 (patch)
tree760603813d19d1e8c73f2d1fa2c5a494d659274a
parenta30a76c93fe1fb5e7d5a4c6d1ca957fc16638786 (diff)
dav1d: add i386 as fuzzing architecture (#2824)
Meson requires a cross file for compiling i386 on x86_64. This unfortunately needs to be generated on the fly to honor oss-fuzz' compiler and compiler flags. Supercedes #2823.
-rw-r--r--projects/dav1d/Dockerfile5
-rwxr-xr-xprojects/dav1d/build.sh10
-rw-r--r--projects/dav1d/linux32.meson18
-rw-r--r--projects/dav1d/project.yaml3
4 files changed, 34 insertions, 2 deletions
diff --git a/projects/dav1d/Dockerfile b/projects/dav1d/Dockerfile
index c06c0070..61340ad6 100644
--- a/projects/dav1d/Dockerfile
+++ b/projects/dav1d/Dockerfile
@@ -20,10 +20,13 @@ MAINTAINER janne-vlc@jannau.net
ADD bionic.list /etc/apt/sources.list.d/bionic.list
ADD nasm_apt.pin /etc/apt/preferences
-RUN apt-get update && apt-get install -y curl python3-pip nasm && \
+RUN dpkg --add-architecture i386 && \
+ apt-get update && \
+ apt-get install --no-install-recommends -y libstdc++-5-dev libstdc++-5-dev:i386 curl python3-pip python3-setuptools python3-wheel nasm && \
pip3 install meson ninja
RUN curl --silent -O https://storage.googleapis.com/aom-test-data/fuzzer/dec_fuzzer_seed_corpus.zip
RUN curl --silent -O https://jannau.net/dav1d_fuzzer_seed_corpus.zip
RUN git clone --depth 1 https://code.videolan.org/videolan/dav1d.git dav1d
WORKDIR dav1d
COPY build.sh $SRC/
+COPY linux32.meson $SRC/
diff --git a/projects/dav1d/build.sh b/projects/dav1d/build.sh
index 6c3d9ee2..252817fe 100755
--- a/projects/dav1d/build.sh
+++ b/projects/dav1d/build.sh
@@ -22,11 +22,19 @@ build=${WORK}/build
rm -rf ${build}
mkdir -p ${build}
-# build library
+# prepare cross file for i386 compiliation
+if [ "$ARCHITECTURE" = "i386" ]; then
+ MESON_CFLAGS="'$(echo $CFLAGS | sed -e 's/ /;, ;/g' | tr \; \')'"
+ MESON_CXXFLAGS="'$(echo $CXXFLAGS | sed -e 's/ /;, ;/g' | tr \; \')'"
+ sed -e "s/CC$/'$CC'/; s/CXX$/'$CXX'/; s/CFLAGS$/[$MESON_CFLAGS]/; s/CXXFLAGS$/[$MESON_CXXFLAGS]/" < ${SRC}/linux32.meson > ${WORK}/linux32.meson
+ CROSS="--cross-file ${WORK}/linux32.meson"
+fi
+# build library
meson -Denable_tools=false -Dfuzzing_engine=oss-fuzz \
-Db_lundef=false -Ddefault_library=static -Dbuildtype=debugoptimized \
-Dlogging=false -Dfuzzer_ldflags=$LIB_FUZZING_ENGINE \
+ ${CROSS:-} \
${build}
ninja -j $(nproc) -C ${build}
diff --git a/projects/dav1d/linux32.meson b/projects/dav1d/linux32.meson
new file mode 100644
index 00000000..f9ca3074
--- /dev/null
+++ b/projects/dav1d/linux32.meson
@@ -0,0 +1,18 @@
+[binaries]
+c = CC
+cpp = CXX
+ar = 'ar'
+strip = 'strip'
+
+[properties]
+c_args = CFLAGS
+c_link_args = CFLAGS
+cpp_args = CXXFLAGS
+cpp_link_args = CXXFLAGS
+
+[host_machine]
+system = 'linux'
+cpu_family = 'x86'
+cpu = 'i686'
+endian = 'little'
+
diff --git a/projects/dav1d/project.yaml b/projects/dav1d/project.yaml
index d0c0e0f5..9ff319f6 100644
--- a/projects/dav1d/project.yaml
+++ b/projects/dav1d/project.yaml
@@ -13,3 +13,6 @@ sanitizers:
- memory
- undefined
coverage_extra_args: -ignore-filename-regex=.*dump.h
+architectures:
+ - i386
+ - x86_64