summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_edit.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-04-04 14:00:20 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-04 14:00:20 +0000
commitc80153d94ed0d540c706b7f7bdb993772b2be9f7 (patch)
tree88e30a535bca8828facbd2e74b1300b4da1ca706 /xfa/fwl/cfwl_edit.cpp
parent28bb2f2ffe751cf4142329e27238da52ae9f848b (diff)
downloadpdfium-c80153d94ed0d540c706b7f7bdb993772b2be9f7.tar.xz
[fwl] Restrict setting cursor outside text bounds
This Cl updates CFWL_Edit to keep the cursor from extending pass the end of the text. If we set the cursor past the end it will trigger the ASSERT in the text edit engine as the edit engine assumes the caller does the right thing. Bug: pdfium:1023 Change-Id: Idfed4b240c13d666a686d0e09b78bcc9a1406794 Reviewed-on: https://pdfium-review.googlesource.com/29650 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fwl/cfwl_edit.cpp')
-rw-r--r--xfa/fwl/cfwl_edit.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index b98278c622..0067cab20a 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -1098,7 +1098,7 @@ void CFWL_Edit::SetCursorPosition(size_t position) {
if (m_CursorPosition == position)
return;
- m_CursorPosition = position;
+ m_CursorPosition = std::min(position, m_EdtEngine.GetLength());
UpdateCursorRect();
OnCaretChanged();
}