diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2022-09-02 17:47:48 +0200 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2022-09-02 18:33:36 +0200 |
commit | d0ab5c4fe6218ebe49dc20ae53420e79d5ce5aad (patch) | |
tree | d60e696143778b446d7e5a11440de12fc4f79a87 /fuzz/testFuzzer.c | |
parent | 17d505e2d23fd7498d7e5ac6ff24b9888c25c5d4 (diff) | |
download | libxml2-d0ab5c4fe6218ebe49dc20ae53420e79d5ce5aad.tar.gz |
Fix compiler warnings in fuzzing code
Diffstat (limited to 'fuzz/testFuzzer.c')
-rw-r--r-- | fuzz/testFuzzer.c | 78 |
1 files changed, 45 insertions, 33 deletions
diff --git a/fuzz/testFuzzer.c b/fuzz/testFuzzer.c index b0c7ffbc..d14b29be 100644 --- a/fuzz/testFuzzer.c +++ b/fuzz/testFuzzer.c @@ -13,51 +13,63 @@ #include "fuzz.h" #ifdef HAVE_HTML_FUZZER - #define LLVMFuzzerInitialize fuzzHtmlInit - #define LLVMFuzzerTestOneInput fuzzHtml - #include "html.c" - #undef LLVMFuzzerInitialize - #undef LLVMFuzzerTestOneInput +int fuzzHtmlInit(int *argc, char ***argv); +int fuzzHtml(const char *data, size_t size); +#define LLVMFuzzerInitialize fuzzHtmlInit +#define LLVMFuzzerTestOneInput fuzzHtml +#include "html.c" +#undef LLVMFuzzerInitialize +#undef LLVMFuzzerTestOneInput #endif #ifdef HAVE_REGEXP_FUZZER - #define LLVMFuzzerInitialize fuzzRegexpInit - #define LLVMFuzzerTestOneInput fuzzRegexp - #include "regexp.c" - #undef LLVMFuzzerInitialize - #undef LLVMFuzzerTestOneInput +int fuzzRegexpInit(int *argc, char ***argv); +int fuzzRegexp(const char *data, size_t size); +#define LLVMFuzzerInitialize fuzzRegexpInit +#define LLVMFuzzerTestOneInput fuzzRegexp +#include "regexp.c" +#undef LLVMFuzzerInitialize +#undef LLVMFuzzerTestOneInput #endif #ifdef HAVE_SCHEMA_FUZZER - #define LLVMFuzzerInitialize fuzzSchemaInit - #define LLVMFuzzerTestOneInput fuzzSchema - #include "schema.c" - #undef LLVMFuzzerInitialize - #undef LLVMFuzzerTestOneInput +int fuzzSchemaInit(int *argc, char ***argv); +int fuzzSchema(const char *data, size_t size); +#define LLVMFuzzerInitialize fuzzSchemaInit +#define LLVMFuzzerTestOneInput fuzzSchema +#include "schema.c" +#undef LLVMFuzzerInitialize +#undef LLVMFuzzerTestOneInput #endif #ifdef HAVE_URI_FUZZER - #define LLVMFuzzerInitialize fuzzUriInit - #define LLVMFuzzerTestOneInput fuzzUri - #include "uri.c" - #undef LLVMFuzzerInitialize - #undef LLVMFuzzerTestOneInput +int fuzzUriInit(int *argc, char ***argv); +int fuzzUri(const char *data, size_t size); +#define LLVMFuzzerInitialize fuzzUriInit +#define LLVMFuzzerTestOneInput fuzzUri +#include "uri.c" +#undef LLVMFuzzerInitialize +#undef LLVMFuzzerTestOneInput #endif #ifdef HAVE_XML_FUZZER - #define LLVMFuzzerInitialize fuzzXmlInit - #define LLVMFuzzerTestOneInput fuzzXml - #include "xml.c" - #undef LLVMFuzzerInitialize - #undef LLVMFuzzerTestOneInput +int fuzzXmlInit(int *argc, char ***argv); +int fuzzXml(const char *data, size_t size); +#define LLVMFuzzerInitialize fuzzXmlInit +#define LLVMFuzzerTestOneInput fuzzXml +#include "xml.c" +#undef LLVMFuzzerInitialize +#undef LLVMFuzzerTestOneInput #endif #ifdef HAVE_XPATH_FUZZER - #define LLVMFuzzerInitialize fuzzXPathInit - #define LLVMFuzzerTestOneInput fuzzXPath - #include "xpath.c" - #undef LLVMFuzzerInitialize - #undef LLVMFuzzerTestOneInput +int fuzzXPathInit(int *argc, char ***argv); +int fuzzXPath(const char *data, size_t size); +#define LLVMFuzzerInitialize fuzzXPathInit +#define LLVMFuzzerTestOneInput fuzzXPath +#include "xpath.c" +#undef LLVMFuzzerInitialize +#undef LLVMFuzzerTestOneInput #endif typedef int @@ -71,7 +83,7 @@ static int testFuzzer(initFunc init, fuzzFunc fuzz, const char *pattern) { glob_t globbuf; int ret = -1; - int i; + size_t i; if (glob(pattern, 0, NULL, &globbuf) != 0) { fprintf(stderr, "pattern %s matches no files\n", pattern); @@ -105,7 +117,7 @@ error: #ifdef HAVE_XML_FUZZER static int -testEntityLoader() { +testEntityLoader(void) { static const char data[] = "doc.xml\\\n" "<!DOCTYPE doc SYSTEM \"doc.dtd\">\n" @@ -148,7 +160,7 @@ testEntityLoader() { #endif int -main() { +main(void) { int ret = 0; #ifdef HAVE_XML_FUZZER |