To: vim_dev@googlegroups.com Subject: Patch 7.4.2233 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2233 Problem: Crash when using funcref() with invalid name. (Dominique Pelle) Solution: Check for NULL translated name. Files: src/evalfunc.c, src/testdir/test_expr.vim *** ../vim-7.4.2232/src/evalfunc.c 2016-08-18 21:22:00.966648696 +0200 --- src/evalfunc.c 2016-08-21 14:35:31.997204847 +0200 *************** *** 3587,3594 **** use_string = TRUE; } ! if (((use_string && vim_strchr(s, AUTOLOAD_CHAR) == NULL) ! || is_funcref)) { name = s; trans_name = trans_function_name(&name, FALSE, --- 3587,3593 ---- use_string = TRUE; } ! if ((use_string && vim_strchr(s, AUTOLOAD_CHAR) == NULL) || is_funcref) { name = s; trans_name = trans_function_name(&name, FALSE, *************** *** 3597,3603 **** s = NULL; } ! if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s))) EMSG2(_(e_invarg2), s); /* Don't check an autoload name for existence here. */ else if (trans_name != NULL && (is_funcref --- 3596,3603 ---- s = NULL; } ! 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 *** ../vim-7.4.2232/src/testdir/test_expr.vim 2016-08-16 21:58:36.726878365 +0200 --- src/testdir/test_expr.vim 2016-08-21 14:34:53.677549416 +0200 *************** *** 237,242 **** --- 237,243 ---- call assert_equal(1, OneByRef()) let OneByRef = funcref('One') call assert_equal(2, OneByRef()) + call assert_fails('echo funcref("{")', 'E475:') endfunc func Test_setmatches() *** ../vim-7.4.2232/src/version.c 2016-08-20 19:22:13.412939701 +0200 --- src/version.c 2016-08-21 14:30:25.171950362 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2233, /**/ -- Everybody lies, but it doesn't matter since nobody listens. -- Lieberman's Law /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///