Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .clusterfuzzlite/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y make autoconf automake libtool

COPY . $SRC/lwgps
COPY .clusterfuzzlite/build.sh $SRC/build.sh
WORKDIR $SRC/lwgps
18 changes: 18 additions & 0 deletions .clusterfuzzlite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ClusterFuzzLite set up
This folder contains a fuzzing set for [ClusterFuzzLite](https://google.github.io/clusterfuzzlite).

## Reproduce locally

If you'd like to test this the way ClusterFuzzLite runs it (by way of [OSS-Fuzz](https://github.com/google/oss-fuzz)) you can use the steps:

```sh
git clone https://github.com/google/oss-fuzz
git clone https://github.com/MaJerle/lwgps lwgps
cd lwgps

# Build the fuzzers in .clusterfuzzlite
python3 ../oss-fuzz/infra/helper.py build_fuzzers --external $PWD

# Run the fuzzer for 180 seconds
python3 ../oss-fuzz/infra/helper.py run_fuzzer --external $PWD process_fuzzer -- -max_total_time=180
```
20 changes: 20 additions & 0 deletions .clusterfuzzlite/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash -eu
# Supply build instructions
# Use the following environment variables to build the code
# $CXX: c++ compiler
# $CC: c compiler
# CFLAGS: compiler flags for C files
# CXXFLAGS: compiler flags for CPP files
# LIB_FUZZING_ENGINE: linker flag for fuzzing harnesses
mkdir build
cd build
cmake ../
make

# Copy all fuzzer executables to $OUT/
$CC $CFLAGS $LIB_FUZZING_ENGINE \
$SRC/lwgps/.clusterfuzzlite/process_fuzzer.c \
-o $OUT/process_fuzzer \
$PWD/CMakeFiles/LwLibPROJECT.dir/lwgps/src/lwgps/lwgps.c.o \
-I$SRC/lwgps/lwgps/src/include \
-I$SRC/lwgps/dev
12 changes: 12 additions & 0 deletions .clusterfuzzlite/process_fuzzer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <stdint.h>
#include <lwgps/lwgps.h>

int
LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
lwgps_t hgps;

lwgps_init(&hgps);
lwgps_process(&hgps, data, size);

return 0;
}
1 change: 1 addition & 0 deletions .clusterfuzzlite/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
language: c
30 changes: 30 additions & 0 deletions .github/workflows/cflite_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: ClusterFuzzLite PR fuzzing
on:
workflow_dispatch:
pull_request:
branches: [ develop ]
permissions: read-all
jobs:
PR:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sanitizer: [address]
steps:
- name: Build Fuzzers (${{ matrix.sanitizer }})
id: build
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
with:
sanitizer: ${{ matrix.sanitizer }}
language: c
bad-build-check: false
- name: Run Fuzzers (${{ matrix.sanitizer }})
id: run
uses: google/clusterfuzzlite/actions/run_fuzzers@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fuzz-seconds: 100
mode: 'code-change'
report-unreproducible-crashes: false
sanitizer: ${{ matrix.sanitizer }}