summaryrefslogtreecommitdiff
path: root/debian/patches/0014-Fix-XPath-optimization-with-predicates.patch
blob: 4fc23a21cca422afc672188beda6f618635d4d87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Sun, 4 Aug 2013 22:15:11 +0000
Subject: Fix XPath '//' optimization with predicates

My attempt to optimize XPath expressions containing '//' caused a
regression reported in bug #695699. This commit disables the
optimization for expressions of the form '//foo[predicate]'.
---
 xpath.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xpath.c b/xpath.c
index 97410e7..a676989 100644
--- a/xpath.c
+++ b/xpath.c
@@ -14719,8 +14719,9 @@ xmlXPathOptimizeExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op)
     * internal representation.
     */
 
-    if ((op->ch1 != -1) &&
-        (op->op == XPATH_OP_COLLECT /* 11 */))
+    if ((op->op == XPATH_OP_COLLECT /* 11 */) &&
+        (op->ch1 != -1) &&
+        (op->ch2 == -1 /* no predicate */))
     {
         xmlXPathStepOpPtr prevop = &comp->steps[op->ch1];