Skip to content

Commit

Permalink
vlc: enable mkv,ogg and xml plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
tguillem committed Feb 6, 2025
1 parent 085fb86 commit 4dccdfe
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
2 changes: 1 addition & 1 deletion projects/vlc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y make autoconf automake libtool \
pkg-config cmake flex bison gettext libglu1-mesa-dev
pkg-config cmake flex bison gettext libglu1-mesa-dev ninja-build
RUN git clone --depth 1 https://code.videolan.org/videolan/vlc.git vlc
RUN git clone --depth 1 https://code.videolan.org/VideoLAN.org/vlc-fuzz-corpus.git vlc/fuzz-corpus
WORKDIR vlc
Expand Down
40 changes: 34 additions & 6 deletions projects/vlc/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,43 @@
#
################################################################################

# Build dependencies without instrumentation
CFLAGS_SAVE="$CFLAGS"
CXXFLAGS_SAVE="$CXXFLAGS"
unset CFLAGS
unset CXXFLAGS
export AFL_NOOPT=1

# But we need libc++
export CXXFLAGS="-stdlib=libc++"

mkdir contrib/contrib-build
cd contrib/contrib-build
../bootstrap

make V=1 -j$(nproc) \
.matroska \
.ogg \
.libxml2

cd ../../

# Resume instrumentation
export CFLAGS="${CFLAGS_SAVE}"
export CXXFLAGS="${CXXFLAGS_SAVE}"
unset AFL_NOOPT

# Use OSS-Fuzz environment rather than hardcoded setup.
sed -i 's/-fsanitize-coverage=trace-pc-guard//g' ./configure.ac
sed -i 's/-fsanitize-coverage=trace-cmp//g' ./configure.ac
sed -i 's/-fsanitize-coverage=trace-pc//g' ./configure.ac
sed -i 's/-lFuzzer//g' ./configure.ac

# In order to build statically we avoid libxml and ogg plugins.
# Use default -lc++
sed -i 's/-lstdc++ //g' ./configure.ac
sed -i 's/-lstdc++/$(NULL)/g' ./test/Makefile.am

sed -i 's/..\/..\/lib\/libvlc_internal.h/lib\/libvlc_internal.h/g' ./test/src/input/decoder.c
sed -i 's/..\/modules\/libxml_plugin.la//g' ./test/Makefile.am
sed -i 's/..\/modules\/libogg_plugin.la//g' ./test/Makefile.am
sed -i 's/f(misc_xml_xml)//g' ./test/src/input/demux-run.c
sed -i 's/f(demux_ogg)//g' ./test/src/input/demux-run.c

# Ensure that we compile with the correct link flags.
RULE="vlc_demux_libfuzzer_LDADD"
Expand All @@ -38,7 +63,10 @@ FUZZ_LDFLAGS="vlc_demux_dec_libfuzzer_LDFLAGS=\${LIB_FUZZING_ENGINE}"
sed -i "s/${RULE}/${FUZZ_LDFLAGS}\n${RULE}/g" ./test/Makefile.am

./bootstrap
./configure --disable-ogg --disable-oggspots --disable-libxml2 --disable-lua \

# libtool calls clang for linking...
LDFLAGS="-stdlib=libc++ -lc++ -lc++abi" \
./configure --disable-lua \
--disable-shared \
--enable-static \
--enable-vlc=no \
Expand Down

0 comments on commit 4dccdfe

Please sign in to comment.