From 7f08348c98325eb303322142148440610b49fe86 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Mon, 6 Aug 2018 17:59:16 +0000 Subject: Clean up a nit that was identified after CQing an earlier CL Change check to use empty instead of size <= 0. Also added a comment to the check to make it clear what is being guarded against BUG=chromium:863098 Change-Id: I993085c04ab66a9e2869c83d8fb48883ec0bbf71 Reviewed-on: https://pdfium-review.googlesource.com/39497 Commit-Queue: Lei Zhang Reviewed-by: Lei Zhang --- core/fxcrt/xml/cfx_xmlparser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/fxcrt') diff --git a/core/fxcrt/xml/cfx_xmlparser.cpp b/core/fxcrt/xml/cfx_xmlparser.cpp index 115b3e7e92..d66d980f38 100644 --- a/core/fxcrt/xml/cfx_xmlparser.cpp +++ b/core/fxcrt/xml/cfx_xmlparser.cpp @@ -134,7 +134,9 @@ bool CFX_XMLParser::DoSyntaxParse(CFX_XMLDocument* doc) { current_parser_state = FDE_XmlSyntaxState::Node; } } else { - if (node_type_stack.size() <= 0 && ch && !FXSYS_iswspace(ch)) + // Fail if there is text outside of the root element, ignore + // whitespace/null. + if (node_type_stack.empty() && ch && !FXSYS_iswspace(ch)) return false; ProcessTextChar(ch); current_buffer_idx++; -- cgit v1.2.3