]> granicus.if.org Git - vim/commitdiff
patch 7.4.2233 v7.4.2233
authorBram Moolenaar <Bram@vim.org>
Sun, 21 Aug 2016 12:36:15 +0000 (14:36 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 21 Aug 2016 12:36:15 +0000 (14:36 +0200)
Problem:    Crash when using funcref() with invalid name. (Dominique Pelle)
Solution:   Check for NULL translated name.

src/evalfunc.c
src/testdir/test_expr.vim
src/version.c

index 16e2365def03073ba6599add13a439e67dd66870..53d3d752ecae034cbe21a8e9afaa75653a3a7efe 100644 (file)
@@ -3587,8 +3587,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
        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,
@@ -3597,7 +3596,8 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
            s = NULL;
     }
 
-    if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s)))
+    if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s))
+                                        || (is_funcref && trans_name == NULL))
        EMSG2(_(e_invarg2), s);
     /* Don't check an autoload name for existence here. */
     else if (trans_name != NULL && (is_funcref
index a7ad65eef4d8c719f20b05f7ce4c1c06e5d5f191..76811255aa03a69c08e44a3cb3c1d81ca2754f7c 100644 (file)
@@ -237,6 +237,7 @@ func Test_funcref()
   call assert_equal(1, OneByRef())
   let OneByRef = funcref('One')
   call assert_equal(2, OneByRef())
+  call assert_fails('echo funcref("{")', 'E475:')
 endfunc
 
 func Test_setmatches()
index 02316bfa47d6718cdbd7f98b7ffe1e25382377d5..0ab89edd8fcf18cff698bd6a53f253ddf7a4c205 100644 (file)
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2233,
 /**/
     2232,
 /**/