From c80153d94ed0d540c706b7f7bdb993772b2be9f7 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 4 Apr 2018 14:00:20 +0000 Subject: [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 Reviewed-by: Ryan Harrison --- xfa/fwl/cfwl_edit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); } -- cgit v1.2.3