Blame SOURCES/libxml2-2.9.1-xsd-any.patch

1b2bf5
From e8c9cd5c7a0d2ea95edf08b13af3baabce62dd63 Mon Sep 17 00:00:00 2001
1b2bf5
From: Nick Wellnhofer <wellnhofer@aevum.de>
1b2bf5
Date: Mon, 16 Sep 2019 15:36:02 +0200
1b2bf5
Subject: [PATCH] Fix Schema determinism check of ##other namespaces
1b2bf5
1b2bf5
Non-compound (##local) and compound string atoms are always disjoint
1b2bf5
regardless of whether the compound atom is negated (##other).
1b2bf5
1b2bf5
Closes #40.
1b2bf5
---
1b2bf5
 result/schemas/issue40_0_0     |  1 +
1b2bf5
 result/schemas/issue40_0_0.err |  0
1b2bf5
 test/schemas/issue40_0.xml     |  3 +++
1b2bf5
 test/schemas/issue40_0.xsd     | 10 ++++++++++
1b2bf5
 xmlregexp.c                    | 15 ++++++++++++---
1b2bf5
 5 files changed, 26 insertions(+), 3 deletions(-)
1b2bf5
 create mode 100644 result/schemas/issue40_0_0
1b2bf5
 create mode 100644 result/schemas/issue40_0_0.err
1b2bf5
 create mode 100644 test/schemas/issue40_0.xml
1b2bf5
 create mode 100644 test/schemas/issue40_0.xsd
1b2bf5
1b2bf5
diff --git a/result/schemas/issue40_0_0 b/result/schemas/issue40_0_0
1b2bf5
new file mode 100644
1b2bf5
index 00000000..73c9e696
1b2bf5
--- /dev/null
1b2bf5
+++ b/result/schemas/issue40_0_0
1b2bf5
@@ -0,0 +1 @@
1b2bf5
+./test/schemas/issue40_0.xml validates
1b2bf5
diff --git a/result/schemas/issue40_0_0.err b/result/schemas/issue40_0_0.err
1b2bf5
new file mode 100644
1b2bf5
index 00000000..e69de29b
1b2bf5
diff --git a/test/schemas/issue40_0.xml b/test/schemas/issue40_0.xml
1b2bf5
new file mode 100644
1b2bf5
index 00000000..86cff1d0
1b2bf5
--- /dev/null
1b2bf5
+++ b/test/schemas/issue40_0.xml
1b2bf5
@@ -0,0 +1,3 @@
1b2bf5
+<a:aaa xmlns:a="aaa_ns">
1b2bf5
+  <x/>
1b2bf5
+</a:aaa>
1b2bf5
diff --git a/test/schemas/issue40_0.xsd b/test/schemas/issue40_0.xsd
1b2bf5
new file mode 100644
1b2bf5
index 00000000..a7eff55b
1b2bf5
--- /dev/null
1b2bf5
+++ b/test/schemas/issue40_0.xsd
1b2bf5
@@ -0,0 +1,10 @@
1b2bf5
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="aaa_ns" xmlns="http://www.w3.org/1999/XSL/Transform">
1b2bf5
+	<xsd:element name="aaa">
1b2bf5
+		<xsd:complexType>
1b2bf5
+			<xsd:choice>
1b2bf5
+				<xsd:any namespace="##other" processContents="skip" />
1b2bf5
+				<xsd:any namespace="##local" processContents="skip" />
1b2bf5
+			</xsd:choice>
1b2bf5
+		</xsd:complexType>
1b2bf5
+	</xsd:element>
1b2bf5
+</xsd:schema>
1b2bf5
diff --git a/xmlregexp.c b/xmlregexp.c
1b2bf5
index 1e8bf934..10969177 100644
1b2bf5
--- a/xmlregexp.c
1b2bf5
+++ b/xmlregexp.c
1b2bf5
@@ -2528,9 +2528,18 @@ xmlFACompareAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2, int deep) {
1b2bf5
         case XML_REGEXP_STRING:
1b2bf5
             if (!deep)
1b2bf5
                 ret = (atom1->valuep != atom2->valuep);
1b2bf5
-            else
1b2bf5
-                ret = xmlRegStrEqualWildcard((xmlChar *)atom1->valuep,
1b2bf5
-                                             (xmlChar *)atom2->valuep);
1b2bf5
+            else {
1b2bf5
+                xmlChar *val1 = (xmlChar *)atom1->valuep;
1b2bf5
+                xmlChar *val2 = (xmlChar *)atom2->valuep;
1b2bf5
+                int compound1 = (xmlStrchr(val1, '|') != NULL);
1b2bf5
+                int compound2 = (xmlStrchr(val2, '|') != NULL);
1b2bf5
+
1b2bf5
+                /* Ignore negative match flag for ##other namespaces */
1b2bf5
+                if (compound1 != compound2)
1b2bf5
+                    return(0);
1b2bf5
+
1b2bf5
+                ret = xmlRegStrEqualWildcard(val1, val2);
1b2bf5
+            }
1b2bf5
 	    break;
1b2bf5
         case XML_REGEXP_EPSILON:
1b2bf5
 	    goto not_determinist;
1b2bf5
-- 
1b2bf5
2.24.2
1b2bf5