summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-28 17:05:08 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-28 17:05:08 +0000
commit3ff28136fef69f1ecd81a9d0d8c278d7120d85f3 (patch)
treeab26a5351ddfebcc3ce014f4db87b6839577b7a4
parentfee749f0a1419e300a49ef657106f580c43842c4 (diff)
downloadpdfium-3ff28136fef69f1ecd81a9d0d8c278d7120d85f3.tar.xz
[XFA] Fix reading off end of name list
When walking the Node name list, we need to verify the element returned is not the end element, not just if the element is not null. Bug: chromium:789113 Change-Id: I04c33a8f2066891e6031035e469c677c404fd724 Reviewed-on: https://pdfium-review.googlesource.com/19670 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r--xfa/fxfa/parser/cxfa_node_statics.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/xfa/fxfa/parser/cxfa_node_statics.cpp b/xfa/fxfa/parser/cxfa_node_statics.cpp
index d0e65c8f62..a33b320216 100644
--- a/xfa/fxfa/parser/cxfa_node_statics.cpp
+++ b/xfa/fxfa/parser/cxfa_node_statics.cpp
@@ -650,7 +650,7 @@ XFA_Element CXFA_Node::NameToElement(const WideString& name) {
auto* elem = std::lower_bound(
std::begin(ElementNameToEnum), std::end(ElementNameToEnum), hash,
[](const ElementNameInfo& a, uint32_t hash) { return a.hash < hash; });
- if (elem && elem->hash == hash)
+ if (elem != std::end(ElementNameToEnum) && elem->hash == hash)
return elem->element;
return XFA_Element::Unknown;
}