summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-21 03:33:37 +0000
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-21 03:33:37 +0000
commit7774cdd96e01b2d89be16f7e240c1ffb2436b4c9 (patch)
treefa4da5ddba8a0553fcf4d4569694a372d0e46d2f /src
parent45b6315d995d70bc117b2ee7320112e54050463c (diff)
XPath: Make sure step_push is called with valid nodes
Some steps relied on step_push rejecting null inputs; this is no longer the case. Additionally stepping now more rigorously filters null inputs. git-svn-id: https://pugixml.googlecode.com/svn/trunk@1069 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src')
-rw-r--r--src/pugixml.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index e9ab09d..5c7fb6d 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -8705,7 +8705,7 @@ PUGI__NS_BEGIN
while (cur && !cur.next_sibling()) cur = cur.parent();
cur = cur.next_sibling();
- for (;;)
+ while (cur)
{
if (step_push(ns, cur, alloc) & once)
return;
@@ -8733,7 +8733,7 @@ PUGI__NS_BEGIN
while (cur && !cur.previous_sibling()) cur = cur.parent();
cur = cur.previous_sibling();
- for (;;)
+ while (cur)
{
if (cur.last_child())
cur = cur.last_child();
@@ -8916,7 +8916,7 @@ PUGI__NS_BEGIN
if (it->node())
step_fill(ns, it->node(), stack.result, once, v);
- else if (axis_has_attributes)
+ else if (axis_has_attributes && it->attribute() && it->parent())
step_fill(ns, it->attribute(), it->parent(), stack.result, once, v);
apply_predicates(ns, size, stack);
@@ -8926,7 +8926,7 @@ PUGI__NS_BEGIN
{
if (c.n.node())
step_fill(ns, c.n.node(), stack.result, once, v);
- else if (axis_has_attributes)
+ else if (axis_has_attributes && c.n.attribute() && c.n.parent())
step_fill(ns, c.n.attribute(), c.n.parent(), stack.result, once, v);
apply_predicates(ns, 0, stack);