summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-05 10:00:14 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-05 19:46:39 +0000
commit62bd019a37ae0753e8153aa530eac3b291b008c4 (patch)
tree35e285e4a02ba10cc3236ffd09ed8f97e724836f /xfa/fxfa
parent5fa4e981ed6c431d86c51a74eba19ea4b816f541 (diff)
downloadpdfium-62bd019a37ae0753e8153aa530eac3b291b008c4.tar.xz
Check first then cast in XFA_FDEExtension_ResolveNamespaceQualifier
Bug: 708383 Change-Id: I6d59fb40bbddd4bdc7224d72bfb789d360f029ca Reviewed-on: https://pdfium-review.googlesource.com/3770 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp
index b3f1302eae..55a85fd6d9 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp
@@ -412,13 +412,14 @@ bool XFA_FDEExtension_ResolveNamespaceQualifier(
} else {
wsNSAttribute = L"xmlns:" + wsQualifier;
}
- for (; pNode != pFakeRoot; pNode = static_cast<CFDE_XMLElement*>(
- pNode->GetNodeItem(CFDE_XMLNode::Parent))) {
- if (pNode->GetType() != FDE_XMLNODE_Element)
+ for (CFDE_XMLNode* pParent = pNode; pParent != pFakeRoot;
+ pParent = pParent->GetNodeItem(CFDE_XMLNode::Parent)) {
+ if (pParent->GetType() != FDE_XMLNODE_Element)
continue;
- if (pNode->HasAttribute(wsNSAttribute.c_str())) {
- *wsNamespaceURI = pNode->GetString(wsNSAttribute.c_str());
+ auto* pElement = static_cast<CFDE_XMLElement*>(pParent);
+ if (pElement->HasAttribute(wsNSAttribute.c_str())) {
+ *wsNamespaceURI = pElement->GetString(wsNSAttribute.c_str());
return true;
}
}