0
0
mirror of https://github.com/vim/vim.git synced 2025-10-10 06:24:10 -04:00

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.
This commit is contained in:
Bram Moolenaar
2021-01-28 17:24:58 +01:00
parent 5ed58c7b70
commit 1d859e2421
3 changed files with 23 additions and 1 deletions

View File

@@ -206,4 +206,20 @@ func Test_ex_mode_with_global()
call delete('Xexmodescript')
endfunc
func Test_ex_mode_count_overflow()
" this used to cause a crash
let lines =<< trim END
call feedkeys("\<Esc>Q\<CR>")
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