diff options
| author | Sean Dewar <seandewar@users.noreply.github.com> | 2022-03-12 08:25:28 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-12 08:25:28 +0000 |
| commit | ab456bc304965d83585cd248284cb36c96927457 (patch) | |
| tree | b01391cee9c3e971072ccb4d27825b61fb10fbbd /src/nvim/testdir | |
| parent | 08d9d74fd91adb29e1f71a48a21df955568cdfcb (diff) | |
| download | rneovim-ab456bc304965d83585cd248284cb36c96927457.tar.gz rneovim-ab456bc304965d83585cd248284cb36c96927457.tar.bz2 rneovim-ab456bc304965d83585cd248284cb36c96927457.zip | |
vim-patch:8.2.3779: using freed memory when defining a user command recursively (#17688)
Problem: Using freed memory when defining a user command from a user
command.
Solution: Do not use the command pointer after executing the command.
(closes vim/vim#9318)
https://github.com/vim/vim/commit/205f29c3e9b895dbaa4f738046da455a93c3812a
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_usercommands.vim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_usercommands.vim b/src/nvim/testdir/test_usercommands.vim index 967ad85a64..e96e3d94e5 100644 --- a/src/nvim/testdir/test_usercommands.vim +++ b/src/nvim/testdir/test_usercommands.vim @@ -572,4 +572,24 @@ func Test_delcommand_buffer() call assert_equal(0, exists(':Global')) endfunc +func DefCmd(name) + if len(a:name) > 30 + return + endif + exe 'command ' .. a:name .. ' call DefCmd("' .. a:name .. 'x")' + echo a:name + exe a:name +endfunc + +func Test_recursive_define() + call DefCmd('Command') + + let name = 'Command' + while len(name) < 30 + exe 'delcommand ' .. name + let name ..= 'x' + endwhile +endfunc + + " vim: shiftwidth=2 sts=2 expandtab |