mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-04 08:02:34 +03:00
Improve HTML fuzzer stability
Call htmlInitAutoClose during fuzzer initialization to fix stability issue. Leave a note concerning problems with this function.
This commit is contained in:
@ -1324,6 +1324,10 @@ htmlCheckAutoClose(const xmlChar * newtag, const xmlChar * oldtag)
|
|||||||
int i, indx;
|
int i, indx;
|
||||||
const char **closed = NULL;
|
const char **closed = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FIXME: This is not thread-safe and should be called from
|
||||||
|
* xmlInitParser instead.
|
||||||
|
*/
|
||||||
if (htmlStartCloseIndexinitialized == 0)
|
if (htmlStartCloseIndexinitialized == 0)
|
||||||
htmlInitAutoClose();
|
htmlInitAutoClose();
|
||||||
|
|
||||||
|
@ -6,12 +6,14 @@
|
|||||||
|
|
||||||
#include <libxml/HTMLparser.h>
|
#include <libxml/HTMLparser.h>
|
||||||
#include <libxml/HTMLtree.h>
|
#include <libxml/HTMLtree.h>
|
||||||
|
#include <libxml/parserInternals.h>
|
||||||
#include "fuzz.h"
|
#include "fuzz.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
LLVMFuzzerInitialize(int *argc ATTRIBUTE_UNUSED,
|
LLVMFuzzerInitialize(int *argc ATTRIBUTE_UNUSED,
|
||||||
char ***argv ATTRIBUTE_UNUSED) {
|
char ***argv ATTRIBUTE_UNUSED) {
|
||||||
xmlInitParser();
|
xmlInitParser();
|
||||||
|
htmlInitAutoClose();
|
||||||
xmlSetGenericErrorFunc(NULL, xmlFuzzErrorFunc);
|
xmlSetGenericErrorFunc(NULL, xmlFuzzErrorFunc);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user