diff options
author | Bram Moolenaar <Bram@vim.org> | 2023-03-04 14:13:10 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-03-04 14:13:10 +0000 |
commit | c99cbf8f289bdda5d4a77d7ec415850a520330ba (patch) | |
tree | d2e538394cb7a8a7c42a4aac6ccf1a8e3256999b | |
parent | 5c6a3c9bad67c2ce766f55dbecb3461f14833a42 (diff) | |
download | vim-git-c99cbf8f289bdda5d4a77d7ec415850a520330ba.tar.gz |
patch 9.0.1378: illegal memory access when using virtual editingv9.0.1378
Problem: Illegal memory access when using virtual editing.
Solution: Make sure "startspaces" is not negative.
-rw-r--r-- | src/register.c | 2 | ||||
-rw-r--r-- | src/testdir/test_virtualedit.vim | 10 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/register.c b/src/register.c index 461363be3..f3df79cfd 100644 --- a/src/register.c +++ b/src/register.c @@ -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++; } } diff --git a/src/testdir/test_virtualedit.vim b/src/testdir/test_virtualedit.vim index 71cea427b..edaae6786 100644 --- a/src/testdir/test_virtualedit.vim +++ b/src/testdir/test_virtualedit.vim @@ -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() diff --git a/src/version.c b/src/version.c index a9cf30e2f..c93499c41 100644 --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1378, +/**/ 1377, /**/ 1376, |