From 3ff28136fef69f1ecd81a9d0d8c278d7120d85f3 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 28 Nov 2017 17:05:08 +0000 Subject: [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 Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_node_statics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- cgit v1.2.3