Skip to content

Commit d301e20

Browse files
committed
Add ClusterFuzzLite PR fuzzing
1 parent 8872d17 commit d301e20

File tree

4 files changed

+105
-0
lines changed

4 files changed

+105
-0
lines changed

.clusterfuzzlite/Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
FROM gcr.io/oss-fuzz-base/base-builder:v1
21+
RUN apt-get update && \
22+
apt-get install -y \
23+
cmake
24+
COPY . $SRC/qpid-proton
25+
WORKDIR qpid-proton
26+
COPY .clusterfuzzlite/build.sh $SRC/

.clusterfuzzlite/build.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash -eu
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
21+
mkdir build
22+
pushd build
23+
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_LIBS=ON -DENABLE_FUZZ_TESTING=ON -DFUZZ_REGRESSION_TESTS=OFF
24+
pushd c/tests/fuzz/
25+
make -j $(nproc)
26+
popd
27+
cp c/tests/fuzz/{fuzz-connection-driver,fuzz-message-decode} $OUT/
28+
popd
29+
30+
zip -j $OUT/fuzz-connection-driver_seed_corpus.zip c/tests/fuzz/fuzz-connection-driver/corpus/* c/tests/fuzz/fuzz-connection-driver/crash/*
31+
zip -j $OUT/fuzz-message-decode_seed_corpus.zip c/tests/fuzz/fuzz-message-decode/corpus/* c/tests/fuzz/fuzz-message-decode/crash/*

.clusterfuzzlite/project.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
language: c++

.github/workflows/cflite_pr.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: ClusterFuzzLite PR fuzzing
2+
on:
3+
pull_request:
4+
paths:
5+
- '**'
6+
permissions: read-all
7+
jobs:
8+
PR:
9+
runs-on: ubuntu-latest
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ matrix.sanitizer }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
sanitizer:
17+
- address
18+
# Override this with the sanitizers you want.
19+
# - undefined
20+
# - memory
21+
steps:
22+
- name: Build Fuzzers (${{ matrix.sanitizer }})
23+
id: build
24+
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
25+
with:
26+
github-token: ${{ secrets.GITHUB_TOKEN }}
27+
sanitizer: ${{ matrix.sanitizer }}
28+
# Optional but recommended: used to only run fuzzers that are affected
29+
# by the PR.
30+
# See later section on "Git repo for storage".
31+
# storage-repo: https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/OWNER/STORAGE-REPO-NAME.git
32+
# storage-repo-branch: main # Optional. Defaults to "main"
33+
# storage-repo-branch-coverage: gh-pages # Optional. Defaults to "gh-pages".
34+
- name: Run Fuzzers (${{ matrix.sanitizer }})
35+
id: run
36+
uses: google/clusterfuzzlite/actions/run_fuzzers@v1
37+
with:
38+
github-token: ${{ secrets.GITHUB_TOKEN }}
39+
fuzz-seconds: 600
40+
mode: 'code-change'
41+
sanitizer: ${{ matrix.sanitizer }}
42+
# Optional but recommended: used to download the corpus produced by
43+
# batch fuzzing.
44+
# See later section on "Git repo for storage".
45+
# storage-repo: https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/OWNER/STORAGE-REPO-NAME.git
46+
# storage-repo-branch: main # Optional. Defaults to "main"
47+
# storage-repo-branch-coverage: gh-pages # Optional. Defaults to "gh-pages".

0 commit comments

Comments
 (0)