diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-04-11 19:56:43 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-11 19:56:43 +0000 |
commit | 4796acb896dabefe6d9a2dbe6d8a61ff7e086dfd (patch) | |
tree | 34a2f08eb2945c0f6bf52fa55937a42d5648625f /xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp | |
parent | 5b1fd5c7f172e32aed4fc47bf57a17c63c13e03c (diff) | |
download | pdfium-4796acb896dabefe6d9a2dbe6d8a61ff7e086dfd.tar.xz |
Make cxfa_fmlexer.cpp resilient to null strings
As currently written, the calculation of m_end will underflow
when passed a {nullptr, 0} pair as input, and m_end becomes
essentially unbounded.
Change-Id: Id3249b201c446555d9aa4fa04e6a3c94a357cd99
Reviewed-on: https://pdfium-review.googlesource.com/30230
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp')
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp index 00dc494582..248b9fead6 100644 --- a/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp @@ -10,6 +10,13 @@ #include "testing/test_support.h" #include "third_party/base/ptr_util.h" +TEST(CXFA_FMLexerTest, NullString) { + WideStringView null_string; + CXFA_FMLexer lexer(null_string); + CXFA_FMToken token = lexer.NextToken(); + EXPECT_EQ(TOKeof, token.m_type); +} + TEST(CXFA_FMLexerTest, EmptyString) { CXFA_FMLexer lexer(L""); CXFA_FMToken token = lexer.NextToken(); |