From d662dfde363b80ce8fc446ab7d8299cbd626f074 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 10 Jun 2021 08:41:48 -0400 Subject: vim-patch:8.2.2422: crash when deleting with line number out of range Problem: Crash when deleting with line number out of range. (Houyunsong) Solution: Avoid using a negative line number. https://github.com/vim/vim/commit/1d859e24218635c57c09801840ff159cb845ae6a --- src/nvim/testdir/test_ex_mode.vim | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_ex_mode.vim b/src/nvim/testdir/test_ex_mode.vim index f70cb261e0..1c645ad0f8 100644 --- a/src/nvim/testdir/test_ex_mode.vim +++ b/src/nvim/testdir/test_ex_mode.vim @@ -1,5 +1,8 @@ " Test editing line in Ex mode (see :help Q and :help gQ). +source check.vim +source shared.vim + " Helper function to test editing line in Q Ex mode func Ex_Q(cmd) " Is there a simpler way to test editing Ex line? @@ -79,4 +82,20 @@ func Test_ex_mode_errors() quit endfunc +func Test_ex_mode_count_overflow() + " this used to cause a crash + let lines =<< trim END + call feedkeys("\Q\") + v9|9silent! vi|333333233333y32333333%O + call writefile(['done'], 'Xdidexmode') + qall! + END + call writefile(lines, 'Xexmodescript') + call assert_equal(1, RunVim([], [], '-e -s -S Xexmodescript -c qa')) + call assert_equal(['done'], readfile('Xdidexmode')) + + call delete('Xdidexmode') + call delete('Xexmodescript') +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit