commit 241562e7abd804006c95893610ed5acacc223b4c
Author: Koji Yokota <[email protected]>
Date:   Mon Oct 20 09:35:31 2025 +0900

    Fix a bug that can cause invalid memory access
---
 src/frontends/qt/GuiInputMethod.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/frontends/qt/GuiInputMethod.cpp 
b/src/frontends/qt/GuiInputMethod.cpp
index 1852155dbd..d08f46211a 100644
--- a/src/frontends/qt/GuiInputMethod.cpp
+++ b/src/frontends/qt/GuiInputMethod.cpp
@@ -1260,6 +1260,8 @@ pos_type GuiInputMethod::getCaretPos(size_type 
preedit_length)
 GuiInputMethod::PreeditRow GuiInputMethod::getCaretInfo(
                const bool real_boundary, const bool virtual_boundary)
 {
+       // the virtual boundary case has the real cusor on the second row of
+       // the preedit inputs
        const pos_type second_row_idx = d->cur_row_idx_ + 1 - virtual_boundary;
 
        // accumulate the length of preedit elements within 
d->rows_[d->cur_row_idx_]
@@ -1285,7 +1287,7 @@ GuiInputMethod::PreeditRow GuiInputMethod::getCaretInfo(
                    second_row_idx + virtual_boundary : d->cur_row_idx_;
 
        // the second row exists and begins with the preedit
-       if (second_row_idx < (pos_type)d->rows_size_ &&
+       if (second_row_idx + virtual_boundary < (pos_type)d->rows_size_ &&
                d->rows_[second_row_idx + 
virtual_boundary].begin()->isPreedit()) {
 
                for (pos_type i = second_row_idx + virtual_boundary;
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to