Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit afe6147

Browse files
mayhem-botForAllSecure Mayhem Bot
authored and
ForAllSecure Mayhem Bot
committedMar 20, 2025·
Mayhem support
1 parent 9b6f559 commit afe6147

5 files changed

+137
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Mayhem
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
workflow_call:
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}
10+
jobs:
11+
build:
12+
name: ${{ matrix.os }} shared=${{ matrix.shared }} ${{ matrix.build_type }}
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest]
17+
shared: [false]
18+
build_type: [Release]
19+
include:
20+
- os: ubuntu-latest
21+
triplet: x64-linux
22+
steps:
23+
- uses: actions/checkout@v2
24+
with:
25+
submodules: recursive
26+
- name: Log in to the Container registry
27+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
- name: Extract metadata (tags, labels) for Docker
33+
id: meta
34+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
35+
with:
36+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
37+
- name: Build and push Docker image
38+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
39+
with:
40+
context: .
41+
file: mayhem/Dockerfile
42+
push: true
43+
tags: ${{ steps.meta.outputs.tags }}
44+
labels: ${{ steps.meta.outputs.labels }}
45+
- name: Start analysis
46+
uses: forallsecure/mcode-action@v1
47+
with:
48+
mayhem-token: ${{ secrets.MAYHEM_TOKEN }}
49+
args: --image ${{ steps.meta.outputs.tags }} --cmd /out/vlc-demux-dec-libfuzzer
50+
--target vlc-demux-dec-libfuzzer --file mayhem/vlc-demux-dec-libfuzzer.mayhemfile
51+
sarif-output: sarif
52+
- name: Upload SARIF file(s)
53+
uses: github/codeql-action/upload-sarif@v2
54+
with:
55+
sarif_file: sarif

‎mayhem/Dockerfile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
################################################################################
16+
17+
FROM gcr.io/oss-fuzz-base/base-builder
18+
RUN apt-get update && apt-get install -y make autoconf automake libtool pkg-config cmake flex bison gettext libglu1-mesa-dev
19+
COPY . vlc
20+
RUN rm -rf vlc/mayhem
21+
WORKDIR vlc
22+
COPY mayhem/build.sh $SRC/
23+
24+
ENV FUZZING_LANGUAGE=c SANITIZER=address
25+
RUN compile

‎mayhem/Dockerfile.dockerignore

Whitespace-only changes.

‎mayhem/build.sh

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash -eu
2+
# Copyright 2021 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
################################################################################
17+
18+
# Use OSS-Fuzz environment rather than hardcoded setup.
19+
sed -i 's/-fsanitize-coverage=trace-pc-guard//g' ./configure.ac
20+
sed -i 's/-fsanitize-coverage=trace-cmp//g' ./configure.ac
21+
sed -i 's/-fsanitize-coverage=trace-pc//g' ./configure.ac
22+
sed -i 's/-lFuzzer//g' ./configure.ac
23+
24+
# In order to build statically we avoid libxml and ogg plugins.
25+
sed -i 's/..\/..\/lib\/libvlc_internal.h/lib\/libvlc_internal.h/g' ./test/src/input/decoder.c
26+
sed -i 's/..\/modules\/libxml_plugin.la//g' ./test/Makefile.am
27+
sed -i 's/..\/modules\/libogg_plugin.la//g' ./test/Makefile.am
28+
sed -i 's/f(misc_xml_xml)//g' ./test/src/input/demux-run.c
29+
sed -i 's/f(demux_ogg)//g' ./test/src/input/demux-run.c
30+
31+
# Ensure that we compile with the correct link flags.
32+
RULE="vlc_demux_libfuzzer_LDADD"
33+
FUZZ_LDFLAGS="vlc_demux_libfuzzer_LDFLAGS=\${LIB_FUZZING_ENGINE}"
34+
sed -i "s/${RULE}/${FUZZ_LDFLAGS}\n${RULE}/g" ./test/Makefile.am
35+
36+
RULE="vlc_demux_dec_libfuzzer_LDADD"
37+
FUZZ_LDFLAGS="vlc_demux_dec_libfuzzer_LDFLAGS=\${LIB_FUZZING_ENGINE}"
38+
sed -i "s/${RULE}/${FUZZ_LDFLAGS}\n${RULE}/g" ./test/Makefile.am
39+
40+
./bootstrap
41+
./configure --disable-ogg --disable-oggspots --disable-libxml2 --disable-lua \
42+
--disable-shared \
43+
--enable-static \
44+
--enable-vlc=no \
45+
--disable-avcodec \
46+
--disable-swscale \
47+
--disable-a52 \
48+
--disable-xcb \
49+
--disable-alsa \
50+
--with-libfuzzer
51+
make V=1 -j$(nproc)
52+
cp ./test/vlc-demux-dec-libfuzzer $OUT/
53+
cp ./test/vlc-demux-libfuzzer $OUT/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
project: PROJECT
2+
target: vlc-demux-dec-libfuzzer
3+
cmds:
4+
- cmd: /out/vlc-demux-dec-libfuzzer

0 commit comments

Comments
 (0)
Please sign in to comment.