1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

tree: Fix xmlTextMerge with NULL args

Restore pre-2.13 behavior. Fixes #875.
This commit is contained in:
Nick Wellnhofer
2025-03-18 11:11:20 +01:00
parent 54c3d42891
commit dd4c0f62fa
2 changed files with 19 additions and 10 deletions

View File

@@ -2461,11 +2461,14 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
first = getNode(0);
second = getNode(1);
argsOk =
(first != NULL && first->type == XML_TEXT_NODE &&
second != NULL && second->type == XML_TEXT_NODE &&
first != second &&
first->name == second->name);
if (argsOk) {
first == NULL ?
second != NULL :
second == NULL ||
(first->type == XML_TEXT_NODE &&
second->type == XML_TEXT_NODE &&
first != second &&
first->name == second->name);
if (argsOk && second != NULL) {
if (second->parent != NULL)
parent = second->parent;
else
@@ -2474,7 +2477,7 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
}
res = xmlTextMerge(first, second);
oomReport = (argsOk && res == NULL);
if (res != NULL) {
if (res != NULL && first != NULL) {
removeNode(second);
dropNode(parent);
checkContent(first);