From 1781a719eeba103f05264cbf71c8063cfa5b0c81 Mon Sep 17 00:00:00 2001 From: fangyunzhong Date: Thu, 9 Feb 2023 10:02:37 +0000 Subject: [PATCH] =?UTF-8?q?lj-oss-fuzz-132298119-0361552=E6=BC=8F=E6=B4=9E?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fangyunzhong --- xinclude.c | 14 ++++++-------- xpointer.c | 13 ++++++------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/xinclude.c b/xinclude.c index b2e6ea1..2a0614d 100644 --- a/xinclude.c +++ b/xinclude.c @@ -1014,15 +1014,15 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target, if (list == NULL) { list = tmp; listParent = cur->parent; + last = tmp; } else { if (level == lastLevel) - xmlAddNextSibling(last, tmp); + last = xmlAddNextSibling(last, tmp); else { - xmlAddChild(last, tmp); + last = xmlAddChild(last, tmp); lastLevel = level; } } - last = tmp; if (index2 > 1) { end = xmlXIncludeGetNthChild(cur, index2 - 1); @@ -1103,12 +1103,11 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target, } if (tmp != NULL) { if (level == lastLevel) - xmlAddNextSibling(last, tmp); + last = xmlAddNextSibling(last, tmp); else { - xmlAddChild(last, tmp); + last = xmlAddChild(last, tmp); lastLevel = level; } - last = tmp; } } /* @@ -1186,8 +1185,7 @@ xmlXIncludeCopyXPointer(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target, if (last == NULL) { list = last = tmp; } else { - xmlAddNextSibling(last, tmp); - last = tmp; + last = xmlAddNextSibling(last, tmp); } cur = cur->next; continue; diff --git a/xpointer.c b/xpointer.c index 3e3c8b8..68ce360 100644 --- a/xpointer.c +++ b/xpointer.c @@ -1470,16 +1470,16 @@ xmlXPtrBuildRangeNodeList(xmlXPathObjectPtr range) { return(list); } else { tmp = xmlCopyNode(cur, 0); - if (list == NULL) + if (list == NULL) { list = tmp; - else { + parent = tmp; + } else { if (last != NULL) - xmlAddNextSibling(last, tmp); + parent = xmlAddNextSibling(last, tmp); else - xmlAddChild(parent, tmp); + parent = xmlAddChild(parent, tmp); } last = NULL; - parent = tmp; if (index2 > 1) { end = xmlXPtrGetNthChild(cur, index2 - 1); @@ -1561,8 +1561,7 @@ xmlXPtrBuildRangeNodeList(xmlXPathObjectPtr range) { if (last != NULL) xmlAddNextSibling(last, tmp); else { - xmlAddChild(parent, tmp); - last = tmp; + last = xmlAddChild(parent, tmp); } } } -- Gitee