Skip to content
Snippets Groups Projects
Commit 2adf5aac authored by vanhauser-thc's avatar vanhauser-thc
Browse files

libfuzzer driver nits

parent f756734a
Branches
Tags
No related merge requests found
...@@ -54,4 +54,5 @@ ...@@ -54,4 +54,5 @@
"__sanitizer_cov_trace_pc_guard"; "__sanitizer_cov_trace_pc_guard";
"__sanitizer_cov_trace_pc_guard_init"; "__sanitizer_cov_trace_pc_guard_init";
"__sanitizer_cov_trace_switch"; "__sanitizer_cov_trace_switch";
"LLVMFuzzerTestOneInput";
}; };
...@@ -33,6 +33,11 @@ $ afl-fuzz -i in -o out -- ./test_fuzzer ...@@ -33,6 +33,11 @@ $ afl-fuzz -i in -o out -- ./test_fuzzer
*/ */
#ifdef __cplusplus
extern "C" {
#endif
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <stdarg.h> #include <stdarg.h>
...@@ -260,6 +265,13 @@ static int ExecuteFilesOnyByOne(int argc, char **argv, ...@@ -260,6 +265,13 @@ static int ExecuteFilesOnyByOne(int argc, char **argv,
__attribute__((weak)) int main(int argc, char **argv) { __attribute__((weak)) int main(int argc, char **argv) {
if (!LLVMFuzzerTestOneInput) {
fprintf(stderr, "Error: function LLVMFuzzerTestOneInput() not found!\n");
abort();
}
if (argc < 2 || strncmp(argv[1], "-h", 2) == 0) if (argc < 2 || strncmp(argv[1], "-h", 2) == 0)
printf( printf(
"============================== INFO ================================\n" "============================== INFO ================================\n"
...@@ -409,3 +421,9 @@ __attribute__((weak)) int LLVMFuzzerRunDriver( ...@@ -409,3 +421,9 @@ __attribute__((weak)) int LLVMFuzzerRunDriver(
} }
#ifdef __cplusplus
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment