diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-05-01 17:02:54 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-01 17:02:54 +0000 |
commit | ba367068887aca9f700289aa1b8c198920ca39a2 (patch) | |
tree | ee04f81558512f9836e5bdb7a06198dd41d15894 /core/fxcrt/xml/cfx_xmlparser.cpp | |
parent | 048afc6aba4848d5296affb4335500f960262580 (diff) | |
download | pdfium-ba367068887aca9f700289aa1b8c198920ca39a2.tar.xz |
Fixes XML Instruction handling in CXFA_DocumentParser.
This CL fixes issues with handling XML instructions in CXFA_DocumentParser.
Unittests were added to verify the behaviour.
Change-Id: Iff8d51d0e6d411419473c9b2c32c700d4bbf86f5
Reviewed-on: https://pdfium-review.googlesource.com/31810
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fxcrt/xml/cfx_xmlparser.cpp')
-rw-r--r-- | core/fxcrt/xml/cfx_xmlparser.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/core/fxcrt/xml/cfx_xmlparser.cpp b/core/fxcrt/xml/cfx_xmlparser.cpp index cbfb949705..c7a81afc16 100644 --- a/core/fxcrt/xml/cfx_xmlparser.cpp +++ b/core/fxcrt/xml/cfx_xmlparser.cpp @@ -175,8 +175,6 @@ bool CFX_XMLParser::Parse() { auto* instruction = static_cast<CFX_XMLInstruction*>(m_pChild); if (!target_data.IsEmpty()) instruction->AppendData(target_data); - if (!GetTextData().IsEmpty()) - instruction->AppendData(GetTextData()); } break; } @@ -248,18 +246,27 @@ FX_XmlSyntaxResult CFX_XMLParser::DoSyntaxParse() { } break; case FDE_XmlSyntaxState::Target: - case FDE_XmlSyntaxState::Tag: if (!IsXMLNameChar(ch, current_text_.empty())) { if (current_text_.empty()) { m_syntaxParserResult = FX_XmlSyntaxResult::Error; return m_syntaxParserResult; } - if (m_syntaxParserState != FDE_XmlSyntaxState::Target) - syntaxParserResult = FX_XmlSyntaxResult::TagName; - else - syntaxParserResult = FX_XmlSyntaxResult::TargetName; + syntaxParserResult = FX_XmlSyntaxResult::TargetName; + m_syntaxParserState = FDE_XmlSyntaxState::TargetData; + } else { + current_text_.push_back(ch); + m_Start++; + } + break; + case FDE_XmlSyntaxState::Tag: + if (!IsXMLNameChar(ch, current_text_.empty())) { + if (current_text_.empty()) { + m_syntaxParserResult = FX_XmlSyntaxResult::Error; + return m_syntaxParserResult; + } + syntaxParserResult = FX_XmlSyntaxResult::TagName; m_syntaxParserState = FDE_XmlSyntaxState::AttriName; } else { current_text_.push_back(ch); @@ -486,7 +493,6 @@ FX_XmlSyntaxResult CFX_XMLParser::DoSyntaxParse() { break; } if (m_wQuotationMark == 0) { - m_wQuotationMark = 0; m_Start++; syntaxParserResult = FX_XmlSyntaxResult::TargetData; break; |