Skip to content

Commit

Permalink
Initial fuzz_target.c
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivam7-1 authored Dec 25, 2024
1 parent 12b27a8 commit fee1d31
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Fuzz/fuzz_target.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#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;
}

0 comments on commit fee1d31

Please sign in to comment.