0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 9.0.1378: illegal memory access when using virtual editing

Problem:    Illegal memory access when using virtual editing.
Solution:   Make sure "startspaces" is not negative.
This commit is contained in:
Bram Moolenaar 2023-03-04 14:13:10 +00:00
parent 5c6a3c9bad
commit c99cbf8f28
3 changed files with 14 additions and 0 deletions

View File

@ -1245,6 +1245,8 @@ op_yank(oparg_T *oap, int deleting, int mess)
// double-count it.
bd.startspaces = (ce - cs + 1)
- oap->start.coladd;
if (bd.startspaces < 0)
bd.startspaces = 0;
startcol++;
}
}

View File

@ -88,6 +88,16 @@ func Test_edit_change()
set virtualedit=
endfunc
func Test_edit_special_char()
new
se ve=all
norm a0
sil! exe "norm o00000\<Nul>k<a0s"
bwipe!
set virtualedit=
endfunc
" Tests for pasting at the beginning, end and middle of a tab character
" in virtual edit mode.
func Test_paste_in_tab()

View File

@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1378,
/**/
1377,
/**/