[libxml] Fix segfault and regressions in xpath tests
Paul Howarth
pghmcfc at fedoraproject.org
Sat Jun 18 21:47:05 UTC 2011
commit 3994c0888d2a470615b669abcbf41091d37e3fe0
Author: Paul Howarth <paul at city-fan.org>
Date: Sat Jun 18 22:45:59 2011 +0100
Fix segfault and regressions in xpath tests
libxml-1.8.17-xpath.patch | 74 +++++++++++++++++++++++++++++++++++++++++++++
libxml.spec | 7 ++++-
2 files changed, 80 insertions(+), 1 deletions(-)
---
diff --git a/libxml-1.8.17-xpath.patch b/libxml-1.8.17-xpath.patch
new file mode 100644
index 0000000..80f067c
--- /dev/null
+++ b/libxml-1.8.17-xpath.patch
@@ -0,0 +1,74 @@
+--- libxml-1.8.17/xpath.c.orig 2011-06-18 16:26:57.430229932 +0100
++++ libxml-1.8.17/xpath.c 2011-06-18 19:27:03.295989406 +0100
+@@ -425,6 +425,8 @@
+ return;
+ }
+ cur->nodeTab = temp;
++ memset(cur->nodeTab + cur->nodeNr, 0,
++ cur->nodeMax * (size_t) sizeof(xmlNodePtr));
+ cur->nodeMax *= 2;
+ }
+ cur->nodeTab[cur->nodeNr++] = val;
+@@ -642,7 +644,7 @@
+
+ ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
+ if (ret == NULL) {
+- fprintf(xmlXPathDebug, "xmlXPathNewFloat: out of memory\n");
++ fprintf(xmlXPathDebug, "xmlXPathNewBoolean: out of memory\n");
+ return(NULL);
+ }
+ memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+@@ -665,7 +667,7 @@
+
+ ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
+ if (ret == NULL) {
+- fprintf(xmlXPathDebug, "xmlXPathNewFloat: out of memory\n");
++ fprintf(xmlXPathDebug, "xmlXPathNewString: out of memory\n");
+ return(NULL);
+ }
+ memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+@@ -688,7 +690,7 @@
+
+ ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
+ if (ret == NULL) {
+- fprintf(xmlXPathDebug, "xmlXPathNewFloat: out of memory\n");
++ fprintf(xmlXPathDebug, "xmlXPathNewCString: out of memory\n");
+ return(NULL);
+ }
+ memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+@@ -712,7 +714,7 @@
+
+ ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
+ if (ret == NULL) {
+- fprintf(xmlXPathDebug, "xmlXPathNewFloat: out of memory\n");
++ fprintf(xmlXPathDebug, "xmlXPathNewNodeSet: out of memory\n");
+ return(NULL);
+ }
+ memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+@@ -736,7 +738,7 @@
+
+ ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
+ if (ret == NULL) {
+- fprintf(xmlXPathDebug, "xmlXPathNewFloat: out of memory\n");
++ fprintf(xmlXPathDebug, "xmlXPathNewNodeSetList: out of memory\n");
+ return(NULL);
+ }
+ memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+@@ -1537,6 +1539,8 @@
+ return(ctxt->context->node->childs);
+ }
+
++ if (cur == (xmlNodePtr) ctxt->context->doc)
++ return(ctxt->context->doc->root);
+ if (cur->childs != NULL) return(cur->childs);
+ if (cur->next != NULL) return(cur->next);
+
+@@ -4483,7 +4487,7 @@
+ *
+ * Evaluate the XPath Location Path in the given context.
+ *
+- * Returns the xmlXPathObjectPtr resulting from the eveluation or NULL.
++ * Returns the xmlXPathObjectPtr resulting from the evaluation or NULL.
+ * the caller has to free the object.
+ */
+ xmlXPathObjectPtr
diff --git a/libxml.spec b/libxml.spec
index 76fd467..d411e64 100644
--- a/libxml.spec
+++ b/libxml.spec
@@ -2,7 +2,7 @@ Name: libxml
Summary: Old XML library for Gnome-1 application compatibility
Epoch: 1
Version: 1.8.17
-Release: 26%{?dist}
+Release: 27%{?dist}
License: LGPLv2+ or W3C
Group: Development/Libraries
URL: http://veillard.com/XML/
@@ -15,6 +15,7 @@ Patch11: libxml-1.8.17-multiarch.patch
Patch12: libxml-1.8.17-declarations.patch
Patch13: libxml-1.8.17-ppc64-config.patch
Patch14: libxml-1.8.17-utf8.patch
+Patch15: libxml-1.8.17-xpath.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu)
%description
@@ -57,6 +58,9 @@ Libraries, includes, etc. to build old libxml-based applications.
# recode ChangeLog as UTF-8
%patch14 -p1
+# fix segfault and regressions in xpath tests
+%patch15 -p1
+
%build
export CFLAGS="%{optflags} -Werror-implicit-function-declaration"
%configure --disable-static
@@ -99,6 +103,7 @@ rm -rf %{buildroot}
%changelog
* Fri Jun 3 2011 Paul Howarth <paul at city-fan.org> 1:1.8.17-27
+- fix segfault and regressions in xpath tests
- use a patch rather than iconv to fix the ChangeLog encoding
* Thu Jun 2 2011 Paul Howarth <paul at city-fan.org> 1:1.8.17-26
More information about the scm-commits
mailing list