code-intelligence.com/cifuzz@v0.40.0/examples/cmake/my_fuzz_test.cpp (about) 1 #include "src/explore_me.h" 2 #include <cifuzz/cifuzz.h> 3 #include <fuzzer/FuzzedDataProvider.h> 4 #include <stdio.h> 5 6 FUZZ_TEST_SETUP() {} 7 8 FUZZ_TEST(const uint8_t *data, size_t size) { 9 10 // As the function we want to fuzz expect two integers and one string we 11 // have to convert/cast the given input data into the expected variables/data 12 // types 13 FuzzedDataProvider fuzzed_data(data, size); 14 int a = fuzzed_data.ConsumeIntegral<int>(); 15 int b = fuzzed_data.ConsumeIntegral<int>(); 16 std::string c = fuzzed_data.ConsumeRandomLengthString(); 17 18 exploreMe(a, b, c); 19 }