forked from zint/zint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuzz.cpp
28 lines (23 loc) · 1 KB
/
fuzz.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <assert.h>
#include <cifuzz/cifuzz.h>
#include <fuzzer/FuzzedDataProvider.h>
FUZZ_TEST_SETUP() {
// Perform any one-time setup required by the FUZZ_TEST function.
}
FUZZ_TEST(const uint8_t *data, size_t size) {
// FuzzedDataProvider provides convenience methods that turn the raw fuzzer
// data into common types. Use it to generate parameters for the function you
// want to fuzz:
//
// FuzzedDataProvider fuzzed_data(data, size);
// int my_int = fuzzed_data.ConsumeIntegral<int8_t>();
// std::string my_string = fuzzed_data.ConsumeRandomLengthString();
// Call the functions you want to test with the provided data and optionally
// assert that the results are as expected:
//
// int res = DoSomething(my_int, my_string);
// assert(res != -1);
// If you want to know more about writing fuzz tests you can check out the
// example projects at https://github.com/CodeIntelligenceTesting/ci-fuzz-cli-tutorials
// or have a look at our docs at https://docs.code-intelligence.com/
}