diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-05-08 15:20:27 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-08 15:20:27 +0000 |
commit | dec08c8d3fbc4e89748f2d655b32727cfab373ed (patch) | |
tree | 9aac943ee5b8471322be5747d02ed8927a5ffa05 /xfa/fxfa/fm2js/cxfa_fmlexer.cpp | |
parent | bda113c645673fd152bb9ca3eaddd3c34920223e (diff) | |
download | pdfium-dec08c8d3fbc4e89748f2d655b32727cfab373ed.tar.xz |
[fm2js] Fail transpiling if lexer has left over data
If there is remaining data after the lexer has said it's complete then
something has gone wrong while lexing the formcalc data. This CL changes
the transpiler to return an error in the case of the lexer havign extra
data.
Bug: chromium:834575
Change-Id: I8a1288a7f01cc69faf2033829d68246d815258de
Reviewed-on: https://pdfium-review.googlesource.com/32130
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa/fxfa/fm2js/cxfa_fmlexer.cpp')
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmlexer.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp index 72fe0f2a01..32e29575c5 100644 --- a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp @@ -133,13 +133,13 @@ CXFA_FMLexer::CXFA_FMLexer(const WideStringView& wsFormCalc) m_end(m_cursor + wsFormCalc.GetLength()), m_lexer_error(false) {} -CXFA_FMLexer::~CXFA_FMLexer() {} +CXFA_FMLexer::~CXFA_FMLexer() = default; CXFA_FMToken CXFA_FMLexer::NextToken() { if (m_lexer_error) return CXFA_FMToken(); - while (m_cursor < m_end && *m_cursor) { + while (!IsComplete() && *m_cursor) { if (!IsFormCalcCharacter(*m_cursor)) { RaiseError(); return CXFA_FMToken(); @@ -323,7 +323,7 @@ CXFA_FMToken CXFA_FMLexer::AdvanceForString() { const wchar_t* start = m_cursor; ++m_cursor; - while (m_cursor < m_end && *m_cursor) { + while (!IsComplete() && *m_cursor) { if (!IsFormCalcCharacter(*m_cursor)) break; @@ -357,7 +357,7 @@ CXFA_FMToken CXFA_FMLexer::AdvanceForString() { CXFA_FMToken CXFA_FMLexer::AdvanceForIdentifier() { const wchar_t* start = m_cursor; ++m_cursor; - while (m_cursor < m_end && *m_cursor) { + while (!IsComplete() && *m_cursor) { if (!IsFormCalcCharacter(*m_cursor)) { RaiseError(); return CXFA_FMToken(); @@ -377,7 +377,7 @@ CXFA_FMToken CXFA_FMLexer::AdvanceForIdentifier() { void CXFA_FMLexer::AdvanceForComment() { m_cursor++; - while (m_cursor < m_end && *m_cursor) { + while (!IsComplete() && *m_cursor) { if (!IsFormCalcCharacter(*m_cursor)) { RaiseError(); return; |