-
-
Notifications
You must be signed in to change notification settings - Fork 22
Add ClusterFuzzLite integration #122
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
Open
DavidKorczynski
wants to merge
4
commits into
NLnetLabs:main
Choose a base branch
from
DavidKorczynski:clusterfuzzlite
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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/simdzone | ||
| COPY .clusterfuzzlite/build.sh $SRC/build.sh | ||
| WORKDIR $SRC/simdzone |
This file contains hidden or 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,3 @@ | ||
| # ClusterFuzzLite set up | ||
| This folder contains a fuzzing set for [ClusterFuzzLite](https://google.github.io/clusterfuzzlite). | ||
|
|
This file contains hidden or 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,13 @@ | ||
| #!/bin/bash -eu | ||
| mkdir build | ||
| cd build | ||
| cmake .. | ||
| make | ||
|
|
||
| # Copy all fuzzer executables to $OUT/ | ||
| $CC $CFLAGS $LIB_FUZZING_ENGINE \ | ||
| $SRC/simdzone/.clusterfuzzlite/zone_parse_string_fuzzer.c \ | ||
| -o $OUT/zone_parse_string_fuzzer \ | ||
| -I$SRC/simdzone/include \ | ||
| -I$SRC/simdzone/build/include \ | ||
| $SRC/simdzone/build/libzone.a |
This file contains hidden or 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 hidden or 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,44 @@ | ||
| #include <stdint.h> | ||
| #include <stdlib.h> | ||
| #include <string.h> | ||
|
|
||
| #include "zone.h" | ||
|
|
||
| static int32_t add_rr(zone_parser_t *parser, const zone_name_t *owner, | ||
| uint16_t type, uint16_t class, uint32_t ttl, | ||
| uint16_t rdlength, const uint8_t *rdata, | ||
| void *user_data) { | ||
| (void)parser; | ||
| (void)owner; | ||
| (void)type; | ||
| (void)class; | ||
| (void)ttl; | ||
| (void)rdlength; | ||
| (void)rdata; | ||
| (void)user_data; | ||
| return ZONE_SUCCESS; | ||
| } | ||
|
|
||
| int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { | ||
| size_t size_of_input = size + ZONE_BLOCK_SIZE + 1; | ||
| char *null_terminated = (char*)malloc(size_of_input); | ||
| memcpy(null_terminated, data, size); | ||
| null_terminated[size] = '\0'; | ||
|
|
||
| zone_parser_t parser = {0}; | ||
| zone_name_buffer_t name; | ||
| zone_rdata_buffer_t rdata; | ||
| zone_buffers_t buffers = {1, &name, &rdata}; | ||
| zone_options_t options = {0}; | ||
|
|
||
| options.accept.callback = add_rr; | ||
| options.origin = "example.com."; | ||
| options.default_ttl = 3600; | ||
| options.default_class = 1; | ||
|
|
||
| zone_parse_string(&parser, &options, &buffers, null_terminated, size_of_input, | ||
| NULL); | ||
|
|
||
| free(null_terminated); | ||
| return 0; | ||
| } | ||
This file contains hidden or 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 }} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor remark:
size_of_inputhere should besize.