0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 9.1.0682: Vim9: Segfault with uninitialized funcref

Problem:  Vim9: Segfault with uninitialized funcref
          (Daniel Viberg)
Solution: Check the Funcref for being Null before trying to access it
          (Ernie Rael)

fixes: #15523

Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Ernie Rael 2024-08-19 21:45:23 +02:00 committed by Christian Brabandt
parent 6bff6a2fa4
commit cb90ea9cba
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
3 changed files with 14 additions and 1 deletions

View File

@ -164,6 +164,16 @@ def Test_wrong_function_name()
END
v9.CheckScriptFailure(lines, 'E1182:')
delfunc g:Define
lines =<< trim END
vim9script
var F1_ref: func
def Start()
F1_ref()
enddef
Start()
END
v9.CheckScriptFailure(lines, 'E117:')
enddef
" Check that in a legacy script a :def accesses the correct script variables.

View File

@ -2245,7 +2245,8 @@ find_func_imported(char_u *name, int flags)
if (!HASHITEM_EMPTY(hi))
{
dictitem_T *di = HI2DI(hi);
if (di->di_tv.v_type == VAR_FUNC)
if (di->di_tv.v_type == VAR_FUNC
&& di->di_tv.vval.v_string != NULL)
func = find_func_even_dead(di->di_tv.vval.v_string, flags);
}
}

View File

@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
682,
/**/
681,
/**/