From 527e861cbb9c47411c4ba86dbdb9fc79bde47452 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 17 May 2022 08:10:34 +0800 Subject: 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. https://github.com/vim/vim/commit/7ce5b2b590256ce53d6af28c1d203fb3bc1d2d97 --- src/nvim/edit.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/nvim/edit.c') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 357e9184d7..aa77c03b48 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -6770,13 +6770,8 @@ static void stop_insert(pos_T *end_insert_pos, int esc, int nomove) // 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(); } } } -- cgit