-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ClusterFuzzLite set up Signed-off-by: David Korczynski <[email protected]> * Extend ClusterFuzzLite README Signed-off-by: David Korczynski <[email protected]> * Add newlines to ClusterFuzzLite Signed-off-by: David Korczynski <[email protected]> * ClusterFuzzLite: nit Signed-off-by: David Korczynski <[email protected]> --------- Signed-off-by: David Korczynski <[email protected]>
- Loading branch information
1 parent
8c7ba86
commit 0423144
Showing
6 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/corejson | ||
COPY .clusterfuzzlite/build.sh $SRC/build.sh | ||
WORKDIR $SRC/corejson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# ClusterFuzzLite set up | ||
|
||
This folder contains a fuzzing set for [ClusterFuzzLite](https://google.github.io/clusterfuzzlite). | ||
|
||
|
||
## Running the fuzzer locally | ||
|
||
To reproduce the fuzzing by way of [OSS-Fuzz](https://github.com/google/oss-fuzz) (which ClusterFuzzLite will be using): | ||
|
||
```sh | ||
git clone https://github.com/google/oss-fuzz | ||
|
||
# Notice the destination folder shuold be in lower case. | ||
git clone https://github.com/FreeRTOS/coreJSON corejson | ||
cd corejson | ||
|
||
# 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 validate_fuzzer -- -max_total_time=180 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash -eu | ||
|
||
# Copy the fuzzer executable to $OUT/ | ||
$CC $CFLAGS $LIB_FUZZING_ENGINE \ | ||
$SRC/corejson/.clusterfuzzlite/validate_fuzzer.c \ | ||
$SRC/corejson/source/core_json.c \ | ||
-I$SRC/corejson/source/include \ | ||
-o $OUT/validate_fuzzer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
language: c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <core_json.h> | ||
#include <stdint.h> | ||
|
||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { | ||
JSON_Validate((char *)data, size); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: ClusterFuzzLite PR fuzzing | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: [ main ] | ||
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: 180 | ||
mode: 'code-change' | ||
report-unreproducible-crashes: false | ||
sanitizer: ${{ matrix.sanitizer }} |