summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-08-06 17:59:16 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-06 17:59:16 +0000
commit7f08348c98325eb303322142148440610b49fe86 (patch)
treebc2aa5a426fcb660ddbc443e9208599b9c799109
parenta7a957f7cec2380b1f04f7166780dba50c0d5d85 (diff)
downloadpdfium-7f08348c98325eb303322142148440610b49fe86.tar.xz
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 <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
-rw-r--r--core/fxcrt/xml/cfx_xmlparser.cpp4
1 files changed, 3 insertions, 1 deletions
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++;