summaryrefslogtreecommitdiff
path: root/fpdfsdk/pwl/cpwl_edit_impl.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-08-31 14:22:39 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-31 18:46:22 +0000
commitf8763bb449273667ef5ff11a0fa491e3e8b46136 (patch)
tree0c68d0605fce2d31ad903891049a00110cbe3757 /fpdfsdk/pwl/cpwl_edit_impl.cpp
parent671f0d4949d412f26fba6c675cfb54b1fc170be0 (diff)
downloadpdfium-f8763bb449273667ef5ff11a0fa491e3e8b46136.tar.xz
Properly handle \n, \r, \r\n when inserting text
BUG=pdfium:877 Change-Id: I6aa3e53057c27700c2d3c0c1692fa86ae9b3a03c Reviewed-on: https://pdfium-review.googlesource.com/12711 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fpdfsdk/pwl/cpwl_edit_impl.cpp')
-rw-r--r--fpdfsdk/pwl/cpwl_edit_impl.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp
index 42eaa16667..c44301f212 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp
@@ -1846,13 +1846,11 @@ CPVT_WordPlace CPWL_EditImpl::DoInsertText(const CPVT_WordPlace& place,
switch (word) {
case 0x0D:
wp = m_pVT->InsertSection(wp, nullptr, nullptr);
- if (sText[i + 1] == 0x0A)
+ if (i + 1 < sz && sText[i + 1] == 0x0A)
i++;
break;
case 0x0A:
wp = m_pVT->InsertSection(wp, nullptr, nullptr);
- if (sText[i + 1] == 0x0D)
- i++;
break;
case 0x09:
word = 0x20;