mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
fix(completion): avoid freeing uninitialized value (#33459)
(cherry picked from commit 51caf0a3af
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
526444c4ff
commit
e4007551c4
@@ -3242,7 +3242,7 @@ static int ExpandUserList(expand_T *xp, char ***matches, int *numMatches)
|
|||||||
|
|
||||||
static int ExpandUserLua(expand_T *xp, int *num_file, char ***file)
|
static int ExpandUserLua(expand_T *xp, int *num_file, char ***file)
|
||||||
{
|
{
|
||||||
typval_T rettv;
|
typval_T rettv = TV_INITIAL_VALUE;
|
||||||
nlua_call_user_expand_func(xp, &rettv);
|
nlua_call_user_expand_func(xp, &rettv);
|
||||||
if (rettv.v_type != VAR_LIST) {
|
if (rettv.v_type != VAR_LIST) {
|
||||||
tv_clear(&rettv);
|
tv_clear(&rettv);
|
||||||
|
@@ -681,6 +681,19 @@ describe('nvim_create_user_command', function()
|
|||||||
eq('Test bbb', fn.getcmdline())
|
eq('Test bbb', fn.getcmdline())
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('no crash when Lua complete function errors #33447', function()
|
||||||
|
exec_lua([[
|
||||||
|
vim.api.nvim_create_user_command('Test','', {
|
||||||
|
nargs = 1,
|
||||||
|
complete = function() error() end
|
||||||
|
})
|
||||||
|
]])
|
||||||
|
feed(':Test <Tab>')
|
||||||
|
eq('E5108: Error executing Lua function: [NULL]', api.nvim_get_vvar('errmsg'))
|
||||||
|
eq('Test ', fn.getcmdline())
|
||||||
|
assert_alive()
|
||||||
|
end)
|
||||||
|
|
||||||
it('does not allow invalid command names', function()
|
it('does not allow invalid command names', function()
|
||||||
eq(
|
eq(
|
||||||
"Invalid command name (must start with uppercase): 'test'",
|
"Invalid command name (must start with uppercase): 'test'",
|
||||||
|
Reference in New Issue
Block a user