-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cflite and document normalize path (#280)
* make it clear resolve_path expects null-terminated string Signed-off-by: David Korczynski <david@adalogics.com>
- Loading branch information
1 parent
c8d4f01
commit 6eeddba
Showing
7 changed files
with
98 additions
and
1 deletion.
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/uvwasi | ||
COPY .clusterfuzzlite/build.sh $SRC/build.sh | ||
COPY .clusterfuzzlite/*.c $SRC/ | ||
WORKDIR uvwasi |
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,11 @@ | ||
# Disable building of shared library | ||
#sed -i 's/add\_library(uvwasi SHARED/# /g' CMakeLists.txt | ||
mkdir build | ||
cd build | ||
cmake ../ | ||
make uvwasi_a | ||
|
||
$CC $CFLAGS $LIB_FUZZING_ENGINE ../.clusterfuzzlite/fuzz_normalize_path.c \ | ||
-o $OUT/fuzz_normalize_path \ | ||
./libuvwasi_a.a _deps/libuv-build/libuv_a.a \ | ||
-I$SRC/uvwasi/include -I$PWD/_deps/libuv-src/include/ |
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,25 @@ | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
#include "../src/path_resolver.h" | ||
|
||
#define BUFFER_SIZE 128 | ||
|
||
char normalized_buffer[BUFFER_SIZE+1]; | ||
|
||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { | ||
char *new_str = (char *)malloc(size + 1); | ||
if (new_str == NULL) { | ||
return 0; | ||
} | ||
memcpy(new_str, data, size); | ||
new_str[size] = '\0'; | ||
|
||
memset(normalized_buffer, 0, BUFFER_SIZE); | ||
|
||
uvwasi__normalize_path(new_str, size, normalized_buffer, BUFFER_SIZE); | ||
|
||
free(new_str); | ||
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 @@ | ||
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,29 @@ | ||
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: | ||
fuzz-seconds: 100 | ||
mode: 'code-change' | ||
report-unreproducible-crashes: false | ||
sanitizer: ${{ matrix.sanitizer }} |
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
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