diff options
author | Michael Ennen <mike.ennen@gmail.com> | 2016-12-19 17:21:50 -0700 |
---|---|---|
committer | Michael Ennen <mike.ennen@gmail.com> | 2017-02-14 17:38:19 -0700 |
commit | effe760b134589f8024d6a5f1cb2c7b979054937 (patch) | |
tree | a6e7fd16061a625176d9708ca6f79ec7227f1629 | |
parent | 8cae66b5e04467322b3dcd20d0a998d9f327efb9 (diff) | |
download | rneovim-effe760b134589f8024d6a5f1cb2c7b979054937.tar.gz rneovim-effe760b134589f8024d6a5f1cb2c7b979054937.tar.bz2 rneovim-effe760b134589f8024d6a5f1cb2c7b979054937.zip |
vim-patch:7.4.2233
Problem: Crash when using funcref() with invalid name. (Dominique Pelle)
Solution: Check for NULL translated name.
https://github.com/vim/vim/commit/843b884461de1c79a1d2748549776fb13fc94360
-rw-r--r-- | src/nvim/eval.c | 6 | ||||
-rw-r--r-- | src/nvim/testdir/test_expr.vim | 1 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 068a1b8ed4..5d10002846 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -10054,8 +10054,7 @@ static void common_function(typval_T *argvars, typval_T *rettv, use_string = true; } - if (((use_string && vim_strchr(s, AUTOLOAD_CHAR) == NULL) - || is_funcref)) { + if (((use_string && vim_strchr(s, AUTOLOAD_CHAR) == NULL) || is_funcref)) { name = s; trans_name = trans_function_name(&name, false, TFN_INT | TFN_QUIET | TFN_NO_AUTOLOAD @@ -10064,7 +10063,8 @@ static void common_function(typval_T *argvars, typval_T *rettv, s = NULL; } } - if (s == NULL || *s == NUL || (use_string && ascii_isdigit(*s))) { + if (s == NULL || *s == NUL || (use_string && ascii_isdigit(*s)) + || (is_funcref && trans_name == NULL)) { EMSG2(_(e_invarg2), s); } else if (trans_name != NULL && (is_funcref ? find_func(trans_name) == NULL diff --git a/src/nvim/testdir/test_expr.vim b/src/nvim/testdir/test_expr.vim index 419d539b42..3b87c4b087 100644 --- a/src/nvim/testdir/test_expr.vim +++ b/src/nvim/testdir/test_expr.vim @@ -164,4 +164,5 @@ func Test_funcref() call assert_equal(1, OneByRef()) let OneByRef = funcref('One') call assert_equal(2, OneByRef()) + call assert_fails('echo funcref("{")', 'E475:') endfunc diff --git a/src/nvim/version.c b/src/nvim/version.c index 88c54756d2..bd8dacfd8d 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -207,7 +207,7 @@ static int included_patches[] = { // 2236, // 2235, // 2234 NA - // 2233, + 2233, // 2232 NA // 2231, // 2230, |