mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-27 18:50:07 +03:00
fuzz: Fix failure injection in schema fuzzer
This commit is contained in:
parent
fd359a7e49
commit
f5257d92bf
@ -35,7 +35,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define XML_DEPRECATED
|
||||
#ifndef XML_DEPRECATED
|
||||
#define XML_DEPRECATED
|
||||
#endif
|
||||
|
||||
#include <libxml/catalog.h>
|
||||
#include <libxml/HTMLtree.h>
|
||||
|
@ -4,8 +4,13 @@
|
||||
* See Copyright for the status of this software.
|
||||
*/
|
||||
|
||||
#ifndef XML_DEPRECATED
|
||||
#define XML_DEPRECATED
|
||||
#endif
|
||||
|
||||
#include <libxml/catalog.h>
|
||||
#include <libxml/xmlschemas.h>
|
||||
#include <libxml/xmlschemastypes.h>
|
||||
#include "fuzz.h"
|
||||
|
||||
int
|
||||
@ -30,9 +35,10 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
|
||||
if (size > 200000)
|
||||
return(0);
|
||||
|
||||
xmlFuzzDataInit(data, size);
|
||||
|
||||
failurePos = xmlFuzzReadInt(4) % (size + 100);
|
||||
|
||||
xmlFuzzDataInit(data, size);
|
||||
xmlFuzzReadEntities();
|
||||
|
||||
xmlFuzzInjectFailure(failurePos);
|
||||
@ -66,6 +72,7 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
|
||||
xmlFuzzInjectFailure(0);
|
||||
xmlFuzzDataCleanup();
|
||||
xmlResetLastError();
|
||||
xmlSchemaCleanupTypes();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
@ -5,6 +5,10 @@
|
||||
* See Copyright for the status of this software.
|
||||
*/
|
||||
|
||||
#ifndef XML_DEPRECATED
|
||||
#define XML_DEPRECATED
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <glob.h>
|
||||
#include <libxml/parser.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user