Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mpv: enable MSAN #11942

Merged
merged 3 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions projects/mpv/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
# limitations under the License.

FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y nasm libass-dev libass-dev:i386 && pip3 install meson ninja
RUN apt-get update && apt-get install -y nasm pkg-config gperf && pip3 install meson ninja
RUN git clone --depth 1 https://github.com/mpv-player/mpv mpv
RUN git clone --depth 1 https://github.com/FFmpeg/FFmpeg ffmpeg
RUN git clone --depth 1 --recursive https://github.com/haasn/libplacebo libplacebo
WORKDIR mpv
COPY build.sh $SRC/
38 changes: 28 additions & 10 deletions projects/mpv/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,45 @@ pushd $SRC/ffmpeg
./configure --cc=$CC --cxx=$CXX --ld="$CXX $CXXFLAGS" \
--disable-shared --enable-gpl --enable-nonfree \
--disable-programs --disable-asm --pkg-config-flags="--static" \
--disable-protocol=rtp,srtp \
$FFMPEG_BUILD_ARGS
make -j`nproc`
make install
popd

pushd $SRC/libplacebo
meson setup build -Ddefault_library=static -Dprefer_static=true --libdir $LIBDIR
meson install -C build
popd

pushd $SRC/mpv
sed -i -e "/^\s*flags += \['-fsanitize=address,undefined,fuzzer', '-fno-omit-frame-pointer'\]/d; \
s|^\s*link_flags += \['-fsanitize=address,undefined,fuzzer', '-fno-omit-frame-pointer'\]| \
link_flags += \['$LIB_FUZZING_ENGINE'\]|" meson.build
mkdir subprojects
meson wrap update-db
# Explicitly download wraps as nested projects have older versions of them.
meson wrap install expat
meson wrap install harfbuzz
meson wrap install libpng
meson wrap install zlib
cat <<EOF > subprojects/libplacebo.wrap
[wrap-git]
url = https://github.com/haasn/libplacebo
revision = master
depth = 1
clone-recursive = true
EOF
cat <<EOF > subprojects/libass.wrap
[wrap-git]
url = https://github.com/libass/libass
revision = master
depth = 1
EOF
meson setup build -Ddefault_library=static -Dprefer_static=true \
-Dfuzzers=true -Dlibmpv=true -Dcplayer=false \
-Dc_link_args="$CXXFLAGS -lc++ -Wl,-rpath,'\$ORIGIN/lib'" \
-Dfuzzers=true -Dlibmpv=true -Dcplayer=false -Dgpl=true \
-Dlibplacebo:lcms=enabled -Dlcms2=enabled \
-Dlcms2:jpeg=disabled -Dlcms2:tiff=disabled -Dlibplacebo:demos=false \
-Dlibass:asm=disabled -Dlibass:libunibreak=enabled -Dlibass:fontconfig=enabled \
-Dc_link_args="$CXXFLAGS -lc++" -Dcpp_link_args="$CXXFLAGS" \
-Dlibarchive=disabled -Drubberband=disabled -Ddrm=disabled -Dwayland=disabled \
-Dlua=disabled -Djavascript=enabled -Duchardet=enabled \
--libdir $LIBDIR
meson compile -C build

cp ./build/fuzzers/fuzzer_* $OUT/ || true
# Static lib not available, requirement pulled by libass
mkdir -p $OUT/lib/
cp /usr/$LIBDIR/libgraphite2.so.3 $OUT/lib/
8 changes: 6 additions & 2 deletions projects/mpv/project.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
homepage: "https://github.com/mpv-player/mpv"
language: c
primary_contact: "[email protected]"
auto_ccs:
- "[email protected]"
architectures:
- x86_64
- i386
- x86_64
- i386
sanitizers:
- address
- memory:
experimental: true
- undefined
main_repo: 'https://github.com/mpv-player/mpv'