mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
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.
This commit is contained in:
12
src/edit.c
12
src/edit.c
@@ -2541,16 +2541,8 @@ stop_insert(
|
||||
|
||||
// <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(ml_get_curline());
|
||||
|
||||
if (VIsual.col > len)
|
||||
{
|
||||
VIsual.col = len;
|
||||
VIsual.coladd = 0;
|
||||
}
|
||||
}
|
||||
if (VIsual_active)
|
||||
check_visual_pos();
|
||||
}
|
||||
}
|
||||
did_ai = FALSE;
|
||||
|
Reference in New Issue
Block a user