2020-06-05 12:49:25 +02:00
/*
* 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>
2020-08-24 03:16:25 +02:00
# include <stdio.h>
2020-06-05 12:49:25 +02:00
# include <libxml/parser.h>
# ifdef __cplusplus
extern " C " {
# endif
2021-02-22 21:26:13 +01:00
# if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
# define HAVE_HTML_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
2022-12-26 17:49:27 +01:00
# if defined(LIBXML_XINCLUDE_ENABLED) && \
defined ( LIBXML_READER_ENABLED )
# define HAVE_XINCLUDE_FUZZER
# endif
2021-02-22 21:26:13 +01:00
# if defined(LIBXML_OUTPUT_ENABLED) && \
2022-12-26 17:49:27 +01:00
defined ( LIBXML_READER_ENABLED )
2021-02-22 21:26:13 +01:00
# define HAVE_XML_FUZZER
# endif
# if defined(LIBXML_XPATH_ENABLED)
# define HAVE_XPATH_FUZZER
# endif
2020-06-05 12:49:25 +02:00
int
LLVMFuzzerInitialize ( int * argc , char * * * argv ) ;
int
LLVMFuzzerTestOneInput ( const char * data , size_t size ) ;
void
xmlFuzzErrorFunc ( void * ctx ATTRIBUTE_UNUSED , const char * msg ATTRIBUTE_UNUSED ,
. . . ) ;
void
xmlFuzzDataInit ( const char * data , size_t size ) ;
void
xmlFuzzDataCleanup ( void ) ;
int
xmlFuzzReadInt ( void ) ;
2020-06-15 12:20:54 +02:00
const char *
xmlFuzzReadRemaining ( size_t * size ) ;
2020-08-06 13:20:01 +02:00
void
xmlFuzzWriteString ( FILE * out , const char * str ) ;
const char *
xmlFuzzReadString ( size_t * size ) ;
2020-06-05 12:49:25 +02:00
void
xmlFuzzReadEntities ( void ) ;
2020-06-21 14:42:00 +02:00
const char *
xmlFuzzMainUrl ( void ) ;
2020-06-05 12:49:25 +02:00
const char *
xmlFuzzMainEntity ( size_t * size ) ;
xmlParserInputPtr
2020-06-21 12:14:19 +02:00
xmlFuzzEntityLoader ( const char * URL , const char * ID , xmlParserCtxtPtr ctxt ) ;
2020-06-05 12:49:25 +02:00
size_t
xmlFuzzExtractStrings ( const char * data , size_t size , char * * strings ,
size_t numStrings ) ;
2020-08-24 03:16:25 +02:00
char *
xmlSlurpFile ( const char * path , size_t * size ) ;
2020-06-05 12:49:25 +02:00
# ifdef __cplusplus
}
# endif
# endif /* __XML_FUZZERCOMMON_H__ */