1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-24 21:33:51 +03:00

fuzz: Check node type before xmlDocSetRootElement

This commit is contained in:
Nick Wellnhofer 2024-03-29 14:54:39 +01:00
parent 5c55332591
commit fe3cbf897e

View File

@ -1688,6 +1688,8 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
root = getNode(2);
if (doc != NULL && doc->parent != NULL)
doc = NULL;
if (!isValidChild((xmlNodePtr) doc, root))
root = NULL;
oldDoc = root ? root->doc : NULL;
oldParent = root ? root->parent : NULL;