diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-21 07:20:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-21 07:20:26 +0800 |
commit | ac99e63d73df84cc20766ad86655724f3a0345b9 (patch) | |
tree | 215ffed160148962d9e0ae03f4d376e12fa7e669 /test | |
parent | d21e6285e93302b6d387ad6d362b683db09c5239 (diff) | |
download | rneovim-ac99e63d73df84cc20766ad86655724f3a0345b9.tar.gz rneovim-ac99e63d73df84cc20766ad86655724f3a0345b9.tar.bz2 rneovim-ac99e63d73df84cc20766ad86655724f3a0345b9.zip |
vim-patch:9.0.1763: crash when passing invalid buffer to undotree() (#24807)
Problem: crash when passing invalid buffer to undotree()
Solution: Use get_buf_arg() instead of tv_get_buf_from_arg().
closes: vim/vim#12862
closes: vim/vim#12830
https://github.com/vim/vim/commit/ab9f2ecfd4ecaf74eeed0e5ec41355589af3ec8f
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/test_undo.vim | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/old/testdir/test_undo.vim b/test/old/testdir/test_undo.vim index 08a0ba4c39..980aa84be6 100644 --- a/test/old/testdir/test_undo.vim +++ b/test/old/testdir/test_undo.vim @@ -134,6 +134,18 @@ func Test_undotree_bufnr() call assert_notequal(d1, d) call assert_equal(d2, d) + " error cases + call assert_fails('call undotree(-1)', 'E158:') + call assert_fails('call undotree("nosuchbuf")', 'E158:') + + " after creating a buffer nosuchbuf, undotree('nosuchbuf') should + " not error out + new nosuchbuf + let d = {'seq_last': 0, 'entries': [], 'time_cur': 0, 'save_last': 0, 'synced': 1, 'save_cur': 0, 'seq_cur': 0} + call assert_equal(d, undotree("nosuchbuf")) + " clean up + bw nosuchbuf + " Drop created windows set ul& new |