patch 9.1.0682: Vim9: Segfault with uninitialized funcref Commit: https://github.com/vim/vim/commit/cb90ea9cba6f033fe141db0e466fb4117f28402b Author: Ernie Rael <err...@raelity.com> Date: Mon Aug 19 21:45:23 2024 +0200
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 <err...@raelity.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index d07bbfba7..030ff833e 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -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. diff --git a/src/userfunc.c b/src/userfunc.c index 9a8239401..5d167101d 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -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); } } diff --git a/src/version.c b/src/version.c index 02b6d91dc..c4472cf60 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 682, /**/ 681, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1sg8Xr-00CNjh-LC%40256bit.org.