Mercurial > vim
changeset 32094:7d94b1c0f292 v9.0.1378
patch 9.0.1378: illegal memory access when using virtual editing
Commit: https://github.com/vim/vim/commit/c99cbf8f289bdda5d4a77d7ec415850a520330ba
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 4 14:13:10 2023 +0000
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 04 Mar 2023 15:15:04 +0100 |
parents | 1b6ac899f079 |
children | 3b1944008f7e |
files | src/register.c src/testdir/test_virtualedit.vim src/version.c |
diffstat | 3 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/register.c +++ b/src/register.c @@ -1245,6 +1245,8 @@ op_yank(oparg_T *oap, int deleting, int // double-count it. bd.startspaces = (ce - cs + 1) - oap->start.coladd; + if (bd.startspaces < 0) + bd.startspaces = 0; startcol++; } }
--- 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()