[packages/libxml2] - added schema patch (fixes schema validation regression, incl. perl-XML-LibXML testsuite) - release

qboosh qboosh at pld-linux.org
Fri Nov 4 22:04:57 CET 2016


commit e7aff1e4dab94e3e64eb513b7b4d6f109c647263
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Fri Nov 4 22:04:52 2016 +0100

    - added schema patch (fixes schema validation regression, incl. perl-XML-LibXML testsuite)
    - release 2

 libxml2-schema.patch | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 libxml2.spec         |  5 +++-
 2 files changed, 70 insertions(+), 1 deletion(-)
---
diff --git a/libxml2.spec b/libxml2.spec
index 41d5e67..cf607be 100644
--- a/libxml2.spec
+++ b/libxml2.spec
@@ -16,7 +16,7 @@ Summary(pl.UTF-8):	Biblioteka libXML wersja 2
 Summary(pt_BR.UTF-8):	Biblioteca libXML versão 2
 Name:		libxml2
 Version:	2.9.4
-Release:	1
+Release:	2
 Epoch:		1
 License:	MIT
 Group:		Libraries
@@ -26,6 +26,8 @@ Source0:	ftp://xmlsoft.org/libxml2/%{name}-%{version}.tar.gz
 Patch0:		%{name}-man_fixes.patch
 Patch1:		%{name}-open.gz.patch
 Patch2:		%{name}-largefile.patch
+# https://git.gnome.org/browse/libxml2/patch/?id=3169602058bd2d04913909e869c61d1540bc7fb4
+Patch3:		%{name}-schema.patch
 URL:		http://xmlsoft.org/
 BuildRequires:	autoconf >= 2.68
 BuildRequires:	automake >= 1.4
@@ -173,6 +175,7 @@ do biblioteki libxml2.
 %patch1 -p1
 %endif
 %patch2 -p1
+%patch3 -p1
 
 %build
 %{__libtoolize}
diff --git a/libxml2-schema.patch b/libxml2-schema.patch
new file mode 100644
index 0000000..2c2efb3
--- /dev/null
+++ b/libxml2-schema.patch
@@ -0,0 +1,66 @@
+From 3169602058bd2d04913909e869c61d1540bc7fb4 Mon Sep 17 00:00:00 2001
+From: Alex Henrie <alexhenrie24 at gmail.com>
+Date: Thu, 26 May 2016 17:38:35 -0600
+Subject: Fix attribute decoding during XML schema validation
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=766834
+
+vctxt->parserCtxt is always NULL in xmlSchemaSAXHandleStartElementNs,
+so this function can't call xmlStringLenDecodeEntities to decode the
+entities.
+---
+ xmlschemas.c | 30 +++++++++++++++++++++++++-----
+ 1 file changed, 25 insertions(+), 5 deletions(-)
+
+diff --git a/xmlschemas.c b/xmlschemas.c
+index 7afe2eb..d42afb7 100644
+--- a/xmlschemas.c
++++ b/xmlschemas.c
+@@ -27391,6 +27391,7 @@ xmlSchemaSAXHandleStartElementNs(void *ctx,
+     * attributes yet.
+     */
+     if (nb_attributes != 0) {
++	int valueLen, k, l;
+ 	xmlChar *value;
+ 
+         for (j = 0, i = 0; i < nb_attributes; i++, j += 5) {
+@@ -27400,12 +27401,31 @@ xmlSchemaSAXHandleStartElementNs(void *ctx,
+ 	    * libxml2 differs from normal SAX here in that it escapes all ampersands
+ 	    * as & instead of delivering the raw converted string. Changing the
+ 	    * behavior at this point would break applications that use this API, so
+-	    * we are forced to work around it. There is no danger of accidentally
+-	    * decoding some entity other than & in this step because without
+-	    * unescaped ampersands there can be no other entities in the string.
++	    * we are forced to work around it.
+ 	    */
+-	    value = xmlStringLenDecodeEntities(vctxt->parserCtxt, attributes[j+3],
+-		attributes[j+4] - attributes[j+3], XML_SUBSTITUTE_REF, 0, 0, 0);
++	    valueLen = attributes[j+4] - attributes[j+3];
++	    value = xmlMallocAtomic(valueLen + 1);
++	    if (value == NULL) {
++		xmlSchemaVErrMemory(vctxt,
++		    "allocating string for decoded attribute",
++		    NULL);
++		goto internal_error;
++	    }
++	    for (k = 0, l = 0; k < valueLen; l++) {
++		if (k < valueLen - 4 &&
++		    attributes[j+3][k+0] == '&' &&
++		    attributes[j+3][k+1] == '#' &&
++		    attributes[j+3][k+2] == '3' &&
++		    attributes[j+3][k+3] == '8' &&
++		    attributes[j+3][k+4] == ';') {
++		    value[l] = '&';
++		    k += 5;
++		} else {
++		    value[l] = attributes[j+3][k];
++		    k++;
++		}
++	    }
++	    value[l] = '\0';
+ 	    /*
+ 	    * TODO: Set the node line.
+ 	    */
+-- 
+cgit v0.12
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libxml2.git/commitdiff/e7aff1e4dab94e3e64eb513b7b4d6f109c647263



More information about the pld-cvs-commit mailing list