mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-05 09:17:38 +03:00
eac1c7e2e5
This only tests the schema parser for now.
35 lines
758 B
C
35 lines
758 B
C
/*
|
|
* xmlSeed.c: Generate the XML seed corpus for fuzzing.
|
|
*
|
|
* See Copyright for the status of this software.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <libxml/xmlschemas.h>
|
|
#include "fuzz.h"
|
|
|
|
int
|
|
main(int argc, char **argv) {
|
|
xmlSchemaPtr schema;
|
|
xmlSchemaParserCtxtPtr pctxt;
|
|
|
|
if (argc != 2) {
|
|
fprintf(stderr, "Usage: schemaSeed [XSD]\n");
|
|
return(1);
|
|
}
|
|
|
|
xmlSetGenericErrorFunc(NULL, xmlFuzzErrorFunc);
|
|
xmlSetExternalEntityLoader(xmlFuzzEntityRecorder);
|
|
|
|
pctxt = xmlSchemaNewParserCtxt(argv[1]);
|
|
xmlSchemaSetParserErrors(pctxt, xmlFuzzErrorFunc, xmlFuzzErrorFunc, NULL);
|
|
schema = xmlSchemaParse(pctxt);
|
|
xmlSchemaFreeParserCtxt(pctxt);
|
|
|
|
xmlSchemaFree(schema);
|
|
xmlFuzzDataCleanup();
|
|
|
|
return(0);
|
|
}
|
|
|