forked from pool/libxml2
Accepting request 751664 from home:pmonrealgonzalez:branches:devel:libraries:c_c++
- Since libxml2-2.9.10 perl-XML-LibXSLT fails to build: [bsc#1157450]
* Revert upstream commit to make xmlFreeNodeList non-recursive
0762c9b69b
- Add patch libxml2-xmlFreeNodeList-recursive.patch
OBS-URL: https://build.opensuse.org/request/show/751664
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libxml2?expand=0&rev=140
This commit is contained in:
68
libxml2-xmlFreeNodeList-recursive.patch
Normal file
68
libxml2-xmlFreeNodeList-recursive.patch
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
From 0762c9b69ba01628f72eada1c64ff3d361fb5716 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
||||||
|
Date: Mon, 23 Sep 2019 17:07:40 +0200
|
||||||
|
Subject: [PATCH] Make xmlFreeNodeList non-recursive
|
||||||
|
|
||||||
|
Avoid call stack overflow when freeing deeply nested documents.
|
||||||
|
---
|
||||||
|
tree.c | 26 +++++++++++++++++++++-----
|
||||||
|
1 file changed, 21 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tree.c b/tree.c
|
||||||
|
index bba061407..478132678 100644
|
||||||
|
--- a/tree.c
|
||||||
|
+++ b/tree.c
|
||||||
|
@@ -3664,7 +3664,9 @@ xmlNextElementSibling(xmlNodePtr node) {
|
||||||
|
void
|
||||||
|
xmlFreeNodeList(xmlNodePtr cur) {
|
||||||
|
xmlNodePtr next;
|
||||||
|
+ xmlNodePtr parent;
|
||||||
|
xmlDictPtr dict = NULL;
|
||||||
|
+ size_t depth = 0;
|
||||||
|
|
||||||
|
if (cur == NULL) return;
|
||||||
|
if (cur->type == XML_NAMESPACE_DECL) {
|
||||||
|
@@ -3680,16 +3682,21 @@ xmlFreeNodeList(xmlNodePtr cur) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cur->doc != NULL) dict = cur->doc->dict;
|
||||||
|
- while (cur != NULL) {
|
||||||
|
+ while (1) {
|
||||||
|
+ while ((cur->children != NULL) &&
|
||||||
|
+ (cur->type != XML_DTD_NODE) &&
|
||||||
|
+ (cur->type != XML_ENTITY_REF_NODE)) {
|
||||||
|
+ cur = cur->children;
|
||||||
|
+ depth += 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
next = cur->next;
|
||||||
|
+ parent = cur->parent;
|
||||||
|
if (cur->type != XML_DTD_NODE) {
|
||||||
|
|
||||||
|
if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue))
|
||||||
|
xmlDeregisterNodeDefaultValue(cur);
|
||||||
|
|
||||||
|
- if ((cur->children != NULL) &&
|
||||||
|
- (cur->type != XML_ENTITY_REF_NODE))
|
||||||
|
- xmlFreeNodeList(cur->children);
|
||||||
|
if (((cur->type == XML_ELEMENT_NODE) ||
|
||||||
|
(cur->type == XML_XINCLUDE_START) ||
|
||||||
|
(cur->type == XML_XINCLUDE_END)) &&
|
||||||
|
@@ -3720,7 +3727,16 @@ xmlFreeNodeList(xmlNodePtr cur) {
|
||||||
|
DICT_FREE(cur->name)
|
||||||
|
xmlFree(cur);
|
||||||
|
}
|
||||||
|
- cur = next;
|
||||||
|
+
|
||||||
|
+ if (next != NULL) {
|
||||||
|
+ cur = next;
|
||||||
|
+ } else {
|
||||||
|
+ if ((depth == 0) || (parent == NULL))
|
||||||
|
+ break;
|
||||||
|
+ depth -= 1;
|
||||||
|
+ cur = parent;
|
||||||
|
+ cur->children = NULL;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Nov 28 15:32:58 UTC 2019 - Pedro Monreal Gonzalez <pmonrealgonzalez@suse.com>
|
||||||
|
|
||||||
|
- Since libxml2-2.9.10 perl-XML-LibXSLT fails to build: [bsc#1157450]
|
||||||
|
* Revert upstream commit to make xmlFreeNodeList non-recursive
|
||||||
|
https://github.com/GNOME/libxml2/commit/0762c9b69ba01628f72eada1c64ff3d361fb5716
|
||||||
|
- Add patch libxml2-xmlFreeNodeList-recursive.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Nov 15 17:59:54 UTC 2019 - Pedro Monreal Gonzalez <pmonrealgonzalez@suse.com>
|
Fri Nov 15 17:59:54 UTC 2019 - Pedro Monreal Gonzalez <pmonrealgonzalez@suse.com>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package libxml2
|
# spec file for package libxml2
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019 SUSE LLC.
|
# Copyright (c) 2019 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@@ -47,6 +47,8 @@ Patch1: libxml2-python3-unicode-errors.patch
|
|||||||
Patch2: libxml2-python3-string-null-check.patch
|
Patch2: libxml2-python3-string-null-check.patch
|
||||||
# PATCH-FIX-SUSE bsc#1135123 Added a new configurable variable XPATH_DEFAULT_MAX_NODESET_LENGTH to avoid nodeset limit
|
# PATCH-FIX-SUSE bsc#1135123 Added a new configurable variable XPATH_DEFAULT_MAX_NODESET_LENGTH to avoid nodeset limit
|
||||||
Patch3: libxml2-make-XPATH_MAX_NODESET_LENGTH-configurable.patch
|
Patch3: libxml2-make-XPATH_MAX_NODESET_LENGTH-configurable.patch
|
||||||
|
# PATCH-FIX-UPSTREAM bsc#1157450 This commit breaks perl-XML-LibXSLT
|
||||||
|
Patch4: libxml2-xmlFreeNodeList-recursive.patch
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: pkgconfig
|
BuildRequires: pkgconfig
|
||||||
BuildRequires: readline-devel
|
BuildRequires: readline-devel
|
||||||
@@ -172,6 +174,7 @@ either at parse time or later once the document has been modified.
|
|||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
|
%patch4 -p1 -R
|
||||||
|
|
||||||
%build
|
%build
|
||||||
export CFLAGS="%{optflags} -fno-strict-aliasing"
|
export CFLAGS="%{optflags} -fno-strict-aliasing"
|
||||||
|
|||||||
Reference in New Issue
Block a user