-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
60 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,4 @@ | ||
FROM gcr.io/oss-fuzz-base/base-builder | ||
RUN git clone --depth 1 https://github.com/OSGeo/grass-addons.git /src/grass-addons | ||
WORKDIR /src/grass-addons | ||
COPY build.sh $SRC/ |
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,9 @@ | ||
#!/bin/bash -eu | ||
|
||
mkdir build | ||
cd build | ||
cmake .. | ||
make -j$(nproc) | ||
|
||
$CXX $CXXFLAGS -I /src/grass-addons/include /src/grass-addons/fuzz_target.c -o $OUT/fuzz_target \ | ||
$LIB_FUZZING_ENGINE /src/grass-addons/src/*.o |
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,39 @@ | ||
#include <stdint.h> | ||
#include <stddef.h> | ||
#include "pavl.h" | ||
#include "sort.h" | ||
#include "local_proto.h" | ||
#include "test_simulation.cpp" | ||
#include "test_treatments.cpp" | ||
|
||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) | ||
{ | ||
if (size < sizeof(int)) | ||
return 0; | ||
|
||
int input = *(int *)data; | ||
|
||
// fuzz test for pavl_create function from pavl.h | ||
struct pavl_table *table = pavl_create(NULL, NULL, NULL); | ||
if (table) { | ||
pavl_destroy(table, NULL); | ||
} | ||
|
||
// fuzz test for Mergesort_increasing_smallest_azimuth function from sort.h | ||
struct node head; | ||
struct node tail; | ||
Mergesort_increasing_smallest_azimuth(&head, &tail); | ||
|
||
// Fuzz test for functions from local_proto.h | ||
float result = f_and(input, input, E); | ||
result += f_or(input, input, E); | ||
result += f_not(input, E); | ||
|
||
// Fuzz test for test_simulation.cpp | ||
ret += test_calling_all_functions(); | ||
|
||
// Fuzz test for test_treatments.cpp | ||
ret += test_steering(); | ||
|
||
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,8 @@ | ||
name: grass-addons | ||
path: OSGeo/grass-addons | ||
homepage: "https://grass.osgeo.org/grass-stable/manuals/addons/" | ||
language: c++ | ||
primary_contact: "[email protected]" | ||
fuzzing_engines: | ||
- libfuzzer | ||
main_repo: 'https://github.com/OSGeo/grass-addons' |