From 23e9d625cf97715abce2c0dead416d8dcd9e6519 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 12 Apr 2023 23:51:43 +0800 Subject: vim-patch:9.0.1444: crash when passing NULL to setcmdline() (#23048) Problem: Crash when passing NULL to setcmdline(). (Andreas Louv) Solution: Use tv_get_string() instead of using v_string directly. (closes vim/vim#12231, closes vim/vim#12227) https://github.com/vim/vim/commit/ac6cd31afcbdd08bfa92ca33f7d4ce5773ba4353 --- test/old/testdir/test_cmdline.vim | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index 1dceb43e5d..6b2a754dd1 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -3532,6 +3532,14 @@ endfunc func Test_setcmdline() func SetText(text, pos) + call assert_equal(0, setcmdline(v:_null_string)) + call assert_equal('', getcmdline()) + call assert_equal(1, getcmdpos()) + + call assert_equal(0, setcmdline(''[: -1])) + call assert_equal('', getcmdline()) + call assert_equal(1, getcmdpos()) + autocmd CmdlineChanged * let g:cmdtype = expand('') call assert_equal(0, setcmdline(a:text)) call assert_equal(a:text, getcmdline()) -- cgit