diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2016-04-27 18:00:12 +0200 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2016-04-27 18:05:06 +0200 |
commit | 839689a9a85d81f722997d00ec17a36b17ce6731 (patch) | |
tree | 36c9496b280bc0c2a9335718ecdde04937c69b95 | |
parent | f39fd66ea768802665e0a010f4be408ef9c69bcf (diff) | |
download | libxml2-839689a9a85d81f722997d00ec17a36b17ce6731.tar.gz |
Don't recurse into OP_VALUEs in xmlXPathOptimizeExpression
The ch1 slot of OP_VALUEs contains an invalid value. Ignore it.
Fixes bug #760325:
https://bugzilla.gnome.org/show_bug.cgi?id=760325
-rw-r--r-- | result/XPath/expr/base | 4 | ||||
-rw-r--r-- | test/XPath/expr/base | 1 | ||||
-rw-r--r-- | xpath.c | 4 |
3 files changed, 9 insertions, 0 deletions
diff --git a/result/XPath/expr/base b/result/XPath/expr/base index d308a920..e04346fa 100644 --- a/result/XPath/expr/base +++ b/result/XPath/expr/base @@ -20,5 +20,9 @@ Expression: (1+2)*(3+4) Object is a number : 21 ======================== +Expression: 1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1 +Object is a number : 21 + +======================== Expression: self::-name Object is empty (NULL) diff --git a/test/XPath/expr/base b/test/XPath/expr/base index 0be4871e..f57e4d0c 100644 --- a/test/XPath/expr/base +++ b/test/XPath/expr/base @@ -3,4 +3,5 @@ 2*3 1+2*3+4 (1+2)*(3+4) +1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1+1*1 self::-name @@ -14786,6 +14786,10 @@ xmlXPathOptimizeExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op) } } + /* OP_VALUE has invalid ch1. */ + if (op->op == XPATH_OP_VALUE) + return; + /* Recurse */ if (op->ch1 != -1) xmlXPathOptimizeExpression(comp, &comp->steps[op->ch1]); |