diff options
| author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-01-15 22:20:21 -0500 |
|---|---|---|
| committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-01-17 19:06:50 -0500 |
| commit | d811fab0ad3e679acc27a4ff8f399fcf04726aa9 (patch) | |
| tree | d51d6493b80546fc52bd7ae8d294b54482d9a875 /src/nvim/testdir | |
| parent | 03da3697a40d56961250028ce60a49ea6e87728b (diff) | |
| download | rneovim-d811fab0ad3e679acc27a4ff8f399fcf04726aa9.tar.gz rneovim-d811fab0ad3e679acc27a4ff8f399fcf04726aa9.tar.bz2 rneovim-d811fab0ad3e679acc27a4ff8f399fcf04726aa9.zip | |
vim-patch:8.2.0120: virtcol() does not check arguments to be valid
Problem: virtcol() does not check arguments to be valid, which may lead to
a crash.
Solution: Check the column to be valid. Do not decrement MAXCOL.
(closes vim/vim#5480)
https://github.com/vim/vim/commit/b3d33d8570bc49a7f90990572d7f9630a1bfae02
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_marks.vim | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/nvim/testdir/test_marks.vim b/src/nvim/testdir/test_marks.vim index 272553c29f..06b9dc9dab 100644 --- a/src/nvim/testdir/test_marks.vim +++ b/src/nvim/testdir/test_marks.vim @@ -26,11 +26,11 @@ function! Test_Incr_Marks() endfunction func Test_setpos() - new one + new Xone let onebuf = bufnr('%') let onewin = win_getid() call setline(1, ['aaa', 'bbb', 'ccc']) - new two + new Xtwo let twobuf = bufnr('%') let twowin = win_getid() call setline(1, ['aaa', 'bbb', 'ccc']) @@ -63,7 +63,24 @@ func Test_setpos() call setpos("'N", [onebuf, 1, 3, 0]) call assert_equal([onebuf, 1, 3, 0], getpos("'N")) + " try invalid column and check virtcol() call win_gotoid(onewin) + call setpos("'a", [0, 1, 2, 0]) + call assert_equal([0, 1, 2, 0], getpos("'a")) + call setpos("'a", [0, 1, -5, 0]) + call assert_equal([0, 1, 2, 0], getpos("'a")) + call setpos("'a", [0, 1, 0, 0]) + call assert_equal([0, 1, 1, 0], getpos("'a")) + call setpos("'a", [0, 1, 4, 0]) + call assert_equal([0, 1, 4, 0], getpos("'a")) + call assert_equal(4, virtcol("'a")) + call setpos("'a", [0, 1, 5, 0]) + call assert_equal([0, 1, 5, 0], getpos("'a")) + call assert_equal(4, virtcol("'a")) + call setpos("'a", [0, 1, 21341234, 0]) + call assert_equal([0, 1, 21341234, 0], getpos("'a")) + call assert_equal(4, virtcol("'a")) + bwipe! call win_gotoid(twowin) bwipe! |