summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2014-03-21 19:38:08 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2014-03-24 13:02:06 +0100
commit07def30fa7d5c5aa73e9d522a2e17bfa7a272df8 (patch)
tree0462566fa8112c51116a059fd26e2f5bdaa55143
parent6faa126fc3ba24a782e832cb0000d6d4f6b7b576 (diff)
downloadlibxml2-07def30fa7d5c5aa73e9d522a2e17bfa7a272df8.tar.gz
Restore context size and position after XPATH_OP_ARG
Fixes a bug with predicates: https://mail.gnome.org/archives/xml/2014-March/msg00014.html
-rw-r--r--xpath.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/xpath.c b/xpath.c
index 89eaba87..dc41ce6b 100644
--- a/xpath.c
+++ b/xpath.c
@@ -13594,17 +13594,20 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
bak = ctxt->context->node;
pp = ctxt->context->proximityPosition;
cs = ctxt->context->contextSize;
- if (op->ch1 != -1)
+ if (op->ch1 != -1) {
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- ctxt->context->contextSize = cs;
- ctxt->context->proximityPosition = pp;
- ctxt->context->node = bak;
- ctxt->context->doc = bakd;
- CHECK_ERROR0;
+ ctxt->context->contextSize = cs;
+ ctxt->context->proximityPosition = pp;
+ ctxt->context->node = bak;
+ ctxt->context->doc = bakd;
+ CHECK_ERROR0;
+ }
if (op->ch2 != -1) {
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
+ ctxt->context->contextSize = cs;
+ ctxt->context->proximityPosition = pp;
+ ctxt->context->node = bak;
+ ctxt->context->doc = bakd;
CHECK_ERROR0;
}
return (total);