mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-26 10:03:34 +03:00
5d542feff1
Silences warnings under Clang on Windows. Signed-off-by: Rosen Penev <rosenp@gmail.com>
131 lines
2.3 KiB
C
131 lines
2.3 KiB
C
/*
|
|
* fuzz.h: Common functions and macros for fuzzing.
|
|
*
|
|
* See Copyright for the status of this software.
|
|
*/
|
|
|
|
#ifndef __XML_FUZZERCOMMON_H__
|
|
#define __XML_FUZZERCOMMON_H__
|
|
|
|
#include <stddef.h>
|
|
#include <stdio.h>
|
|
#include <libxml/parser.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#if __GNUC__ * 100 + __GNUC_MINOR__ >= 207 || defined(__clang__)
|
|
#define ATTRIBUTE_UNUSED __attribute__((unused))
|
|
#else
|
|
#define ATTRIBUTE_UNUSED
|
|
#endif
|
|
|
|
#if defined(LIBXML_HTML_ENABLED)
|
|
#define HAVE_HTML_FUZZER
|
|
#endif
|
|
#if 1
|
|
#define HAVE_LINT_FUZZER
|
|
#endif
|
|
#if defined(LIBXML_READER_ENABLED)
|
|
#define HAVE_READER_FUZZER
|
|
#endif
|
|
#if defined(LIBXML_REGEXP_ENABLED)
|
|
#define HAVE_REGEXP_FUZZER
|
|
#endif
|
|
#if defined(LIBXML_SCHEMAS_ENABLED)
|
|
#define HAVE_SCHEMA_FUZZER
|
|
#endif
|
|
#if 1
|
|
#define HAVE_URI_FUZZER
|
|
#endif
|
|
#if defined(LIBXML_VALID_ENABLED)
|
|
#define HAVE_VALID_FUZZER
|
|
#endif
|
|
#if defined(LIBXML_XINCLUDE_ENABLED)
|
|
#define HAVE_XINCLUDE_FUZZER
|
|
#endif
|
|
#if 1
|
|
#define HAVE_XML_FUZZER
|
|
#endif
|
|
#if defined(LIBXML_XPTR_ENABLED)
|
|
#define HAVE_XPATH_FUZZER
|
|
#endif
|
|
|
|
int
|
|
LLVMFuzzerInitialize(int *argc, char ***argv);
|
|
|
|
int
|
|
LLVMFuzzerTestOneInput(const char *data, size_t size);
|
|
|
|
void
|
|
xmlFuzzErrorFunc(void *ctx, const char *msg, ...);
|
|
|
|
void
|
|
xmlFuzzSErrorFunc(void *ctx, const xmlError *error);
|
|
|
|
void
|
|
xmlFuzzMemSetup(void);
|
|
|
|
void
|
|
xmlFuzzMemSetLimit(size_t limit);
|
|
|
|
int
|
|
xmlFuzzMallocFailed(void);
|
|
|
|
void
|
|
xmlFuzzResetMallocFailed(void);
|
|
|
|
void
|
|
xmlFuzzCheckMallocFailure(const char *func, int expect);
|
|
|
|
void
|
|
xmlFuzzDataInit(const char *data, size_t size);
|
|
|
|
void
|
|
xmlFuzzDataCleanup(void);
|
|
|
|
void
|
|
xmlFuzzWriteInt(FILE *out, size_t v, int size);
|
|
|
|
size_t
|
|
xmlFuzzReadInt(int size);
|
|
|
|
size_t
|
|
xmlFuzzBytesRemaining(void);
|
|
|
|
const char *
|
|
xmlFuzzReadRemaining(size_t *size);
|
|
|
|
void
|
|
xmlFuzzWriteString(FILE *out, const char *str);
|
|
|
|
const char *
|
|
xmlFuzzReadString(size_t *size);
|
|
|
|
void
|
|
xmlFuzzReadEntities(void);
|
|
|
|
const char *
|
|
xmlFuzzMainUrl(void);
|
|
|
|
const char *
|
|
xmlFuzzMainEntity(size_t *size);
|
|
|
|
int
|
|
xmlFuzzResourceLoader(void *data, const char *URL, const char *ID,
|
|
xmlResourceType type, int flags, xmlParserInputPtr *out);
|
|
|
|
xmlParserInputPtr
|
|
xmlFuzzEntityLoader(const char *URL, const char *ID, xmlParserCtxtPtr ctxt);
|
|
|
|
char *
|
|
xmlSlurpFile(const char *path, size_t *size);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __XML_FUZZERCOMMON_H__ */
|
|
|