# HG changeset patch # User Bram Moolenaar # Date 1630148404 -7200 # Node ID c07b6c54146aad28df94ca47360678ad36be2528 # Parent dff7f4a5740c2578ca67418a1764f9391f6820d3 patch 8.2.3380: crash when using NULL string for funcref() Commit: https://github.com/vim/vim/commit/60b6e6f6cc60ac99253e1c13bd0cae4ef0e43201 Author: Bram Moolenaar Date: Sat Aug 28 12:49:27 2021 +0200 patch 8.2.3380: crash when using NULL string for funcref() Problem: Crash when using NULL string for funcref(). Solution: Check for NULL argument. (issue https://github.com/vim/vim/issues/8260) diff --git a/src/evalfunc.c b/src/evalfunc.c --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -3932,6 +3932,11 @@ common_function(typval_T *argvars, typva s = tv_get_string(&argvars[0]); use_string = TRUE; } + if (s == NULL) + { + semsg(_(e_invarg2), "NULL"); + return; + } if ((use_string && vim_strchr(s, AUTOLOAD_CHAR) == NULL) || is_funcref) { diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim --- a/src/testdir/test_expr.vim +++ b/src/testdir/test_expr.vim @@ -501,6 +501,7 @@ func Test_funcref() let OneByRef = funcref("One", repeat(["foo"], 20)) call assert_fails('let OneByRef = funcref("One", repeat(["foo"], 21))', 'E118:') call assert_fails('echo function("min") =~ function("min")', 'E694:') + call assert_fails('echo test_null_function()->funcref()', 'E475: Invalid argument: NULL') endfunc func Test_setmatches() diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -756,6 +756,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3380, +/**/ 3379, /**/ 3378,