Last change
on this file since 102239 was 95312, checked in by vboxsync, 2 years ago |
libs/{curl,libxml2}: OSE export fixes, bugref:8515
|
-
Property svn:eol-style
set to
native
|
File size:
1001 bytes
|
Line | |
---|
1 | /*
|
---|
2 | * schema.c: a libFuzzer target to test the XML Schema processor.
|
---|
3 | *
|
---|
4 | * See Copyright for the status of this software.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #include <libxml/catalog.h>
|
---|
8 | #include <libxml/xmlschemas.h>
|
---|
9 | #include "fuzz.h"
|
---|
10 |
|
---|
11 | int
|
---|
12 | LLVMFuzzerInitialize(int *argc ATTRIBUTE_UNUSED,
|
---|
13 | char ***argv ATTRIBUTE_UNUSED) {
|
---|
14 | xmlInitParser();
|
---|
15 | #ifdef LIBXML_CATALOG_ENABLED
|
---|
16 | xmlInitializeCatalog();
|
---|
17 | #endif
|
---|
18 | xmlSetGenericErrorFunc(NULL, xmlFuzzErrorFunc);
|
---|
19 | xmlSetExternalEntityLoader(xmlFuzzEntityLoader);
|
---|
20 |
|
---|
21 | return 0;
|
---|
22 | }
|
---|
23 |
|
---|
24 | int
|
---|
25 | LLVMFuzzerTestOneInput(const char *data, size_t size) {
|
---|
26 | xmlSchemaParserCtxtPtr pctxt;
|
---|
27 |
|
---|
28 | if (size > 50000)
|
---|
29 | return(0);
|
---|
30 |
|
---|
31 | xmlFuzzDataInit(data, size);
|
---|
32 | xmlFuzzReadEntities();
|
---|
33 |
|
---|
34 | pctxt = xmlSchemaNewParserCtxt(xmlFuzzMainUrl());
|
---|
35 | xmlSchemaSetParserErrors(pctxt, xmlFuzzErrorFunc, xmlFuzzErrorFunc, NULL);
|
---|
36 | xmlSchemaFree(xmlSchemaParse(pctxt));
|
---|
37 | xmlSchemaFreeParserCtxt(pctxt);
|
---|
38 |
|
---|
39 | xmlFuzzDataCleanup();
|
---|
40 | xmlResetLastError();
|
---|
41 |
|
---|
42 | return(0);
|
---|
43 | }
|
---|
44 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.