vim-patch:8.2.4969: changing text in Visual mode may cause invalid memory access

Problem:    Changing text in Visual mode may cause invalid memory access.
Solution:   Check the Visual position after making a change.
7ce5b2b590
This commit is contained in:
zeertzjq
2022-05-17 08:10:34 +08:00
parent 26c906f54d
commit 527e861cbb
4 changed files with 34 additions and 7 deletions

View File

@@ -6770,13 +6770,8 @@ static void stop_insert(pos_T *end_insert_pos, int esc, int nomove)
// <C-S-Right> may have started Visual mode, adjust the position for
// deleted characters.
if (VIsual_active && VIsual.lnum == curwin->w_cursor.lnum) {
int len = (int)STRLEN(get_cursor_line_ptr());
if (VIsual.col > len) {
VIsual.col = len;
VIsual.coladd = 0;
}
if (VIsual_active) {
check_visual_pos();
}
}
}