| * schema.c: a libFuzzer target to test the XML Schema processor. |
| * See Copyright for the status of this software. |
| #include <libxml/catalog.h> |
| #include <libxml/xmlschemas.h> |
| LLVMFuzzerInitialize(int *argc ATTRIBUTE_UNUSED, |
| char ***argv ATTRIBUTE_UNUSED) { |
| #ifdef LIBXML_CATALOG_ENABLED |
| xmlSetGenericErrorFunc(NULL, xmlFuzzErrorFunc); |
| xmlSetExternalEntityLoader(xmlFuzzEntityLoader); |
| LLVMFuzzerTestOneInput(const char *data, size_t size) { |
| xmlSchemaParserCtxtPtr pctxt; |
| xmlFuzzDataInit(data, size); |
| pctxt = xmlSchemaNewParserCtxt(xmlFuzzMainUrl()); |
| xmlSchemaSetParserErrors(pctxt, xmlFuzzErrorFunc, xmlFuzzErrorFunc, NULL); |
| xmlSchemaFree(xmlSchemaParse(pctxt)); |
| xmlSchemaFreeParserCtxt(pctxt); |