34#define BEGIN_INIT_SIMPLE_FUZZER() \
40#define END_INIT_SIMPLE_FUZZER() \
42 catch (const std::exception &e) \
44 fprintf(stderr, "Exception: %s\n", e.what()); \
50#define BEGIN_SIMPLE_FUZZER() \
52 int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) \
56 static bool first = true; \
64#define END_SIMPLE_FUZZER() \
66 catch (const std::exception &e) \
68 fprintf(stderr, "Exception: %s\n", e.what()); \
69 delete el::base::elStorage; \
70 el::base::elStorage = NULL; \
73 delete el::base::elStorage; \
74 el::base::elStorage = NULL; \
84 virtual int init() {
return 0; }
85 virtual int run(
const std::string &filename) = 0;
90#define BEGIN_INIT_SIMPLE_FUZZER() \
91 class SimpleFuzzer: public Fuzzer \
98#define END_INIT_SIMPLE_FUZZER() \
100 catch (const std::exception &e) \
102 fprintf(stderr, "Exception: %s\n", e.what()); \
108#define BEGIN_SIMPLE_FUZZER() \
109 virtual int run(const std::string &filename) \
114 if (!epee::file_io_utils::load_file_to_string(filename, s)) \
116 std::cout << "Error: failed to load file " << filename << std::endl; \
119 const uint8_t *buf = (const uint8_t*)s.data(); \
120 const size_t len = s.size(); \
123#define END_SIMPLE_FUZZER() \
126 catch (const std::exception &e) \
128 fprintf(stderr, "Exception: %s\n", e.what()); \
129 delete el::base::elStorage; \
130 el::base::elStorage = NULL; \
133 delete el::base::elStorage; \
134 el::base::elStorage = NULL; \
138 int main(int argc, const char **argv) \
141 SimpleFuzzer fuzzer; \
142 return run_fuzzer(argc, argv, fuzzer); \
143 CATCH_ENTRY_L0("main", 1); \
virtual int init()
Definition: fuzzer.h:84
virtual int run(const std::string &filename)=0
int run_fuzzer(int argc, const char **argv, Fuzzer &fuzzer)
Definition: fuzzer.cpp:49