components/libxslt/patches/01-libxslt-Fix-direct-pattern-matching-bug.patch
author Vladimir Marek <Vladimir.Marek@oracle.com>
Thu, 24 Oct 2013 13:26:21 +0200
branchs11u1-sru
changeset 2842 2168e180aa83
parent 2471 b1f0e4a84df6
permissions -rw-r--r--
15803356 SUNBT7183526-12.0 Update gzip to version 1.5

Taken as it's from:

http://git.gnome.org/browse/libxslt/commit/?id=2a697a5819f8b22fc7541aae82aacf8b70135a93

Removed git ignore patch part as it doesn't apply and it's not needed.

From 2a697a5819f8b22fc7541aae82aacf8b70135a93 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <[email protected]>
Date: Mon, 08 Nov 2010 09:42:33 +0000
Subject: Fix direct pattern matching bug

and adds a test case for the problem,
also adding a .gitignore cleanup
---
diff --git a/libxslt/pattern.c b/libxslt/pattern.c
index 8ce74e3..58bd6ed 100644
--- a/libxslt/pattern.c
+++ b/libxslt/pattern.c
@@ -546,13 +546,15 @@ xsltTestCompMatchDirect(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
 	xmlNodePtr parent = node->parent;
 	xmlDocPtr olddoc;
 	xmlNodePtr oldnode;
-	int oldNsNr;
+	int oldNsNr, oldContextSize, oldProximityPosition;
 	xmlNsPtr *oldNamespaces;
 
 	oldnode = ctxt->xpathCtxt->node;
 	olddoc = ctxt->xpathCtxt->doc;
 	oldNsNr = ctxt->xpathCtxt->nsNr;
 	oldNamespaces = ctxt->xpathCtxt->namespaces;
+	oldContextSize = ctxt->xpathCtxt->contextSize;
+	oldProximityPosition = ctxt->xpathCtxt->proximityPosition;
 	ctxt->xpathCtxt->node = node;
 	ctxt->xpathCtxt->doc = doc;
 	ctxt->xpathCtxt->namespaces = nsList;
@@ -562,6 +564,8 @@ xsltTestCompMatchDirect(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
 	ctxt->xpathCtxt->doc = olddoc;
 	ctxt->xpathCtxt->namespaces = oldNamespaces;
 	ctxt->xpathCtxt->nsNr = oldNsNr;
+	ctxt->xpathCtxt->contextSize = oldContextSize;
+	ctxt->xpathCtxt->proximityPosition = oldProximityPosition;
 	if (newlist == NULL)
 	    return(-1);
 	if (newlist->type != XPATH_NODESET) {
diff --git a/tests/docs/bug-170.xml b/tests/docs/bug-170.xml
new file mode 100644
index 0000000..08c3c4d
--- a/dev/null
+++ b/tests/docs/bug-170.xml
@@ -0,0 +1,3 @@
+<root>
+    <a type="b"/>
+</root>
diff --git a/tests/general/Makefile.am b/tests/general/Makefile.am
index 5d5baf0..e33a6c6 100644
--- a/tests/general/Makefile.am
+++ b/tests/general/Makefile.am
@@ -177,6 +177,7 @@ EXTRA_DIST = \
     bug-167.out bug-167.xsl \
     bug-168.out bug-168.xsl \
     bug-169.out bug-169.xsl bug-169.imp \
+    bug-170.out bug-170.xsl \
     character.out character.xsl \
     character2.out character2.xsl \
     itemschoose.out itemschoose.xsl \
diff --git a/tests/general/bug-170.out b/tests/general/bug-170.out
new file mode 100644
index 0000000..e24f8d3
--- a/dev/null
+++ b/tests/general/bug-170.out
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+
+    
+
diff --git a/tests/general/bug-170.xsl b/tests/general/bug-170.xsl
new file mode 100644
index 0000000..393bc4b
--- a/dev/null
+++ b/tests/general/bug-170.xsl
@@ -0,0 +1,6 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:template match="a[@type='b']" >
+        <xsl:if test="position()"/>
+    </xsl:template>
+    <xsl:template match="a[@type='XX'][.]"/>
+</xsl:stylesheet>
--
cgit v0.9.0.2