]> granicus.if.org Git - vim/commitdiff
patch 8.1.2412: crash when evaluating expression with error v8.1.2412
authorBram Moolenaar <Bram@vim.org>
Sun, 8 Dec 2019 17:41:34 +0000 (18:41 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 8 Dec 2019 17:41:34 +0000 (18:41 +0100)
Problem:    Crash when evaluating expression with error. (Dhiraj Mishra)
Solution:   Check parsing failed. (closes #5329)

src/eval.c
src/testdir/test_lambda.vim
src/version.c

index 178f47388e1a67988e877144b2580a4e6cd106c3..3b563f7dbe1763f5956accca9280502c60c296b9 100644 (file)
@@ -2902,7 +2902,7 @@ eval_lambda(
     rettv->v_type = VAR_UNKNOWN;
 
     ret = get_lambda_tv(arg, rettv, evaluate);
-    if (ret == NOTDONE)
+    if (ret != OK)
        return FAIL;
     else if (**arg != '(')
     {
index 7689219955236896ec56d7f4be13b1acf98709c8..c55de67b525d1b7aec60463e39a3c05e731aa1cb 100644 (file)
@@ -302,3 +302,8 @@ func Test_lambda_with_index()
   let Extract = {-> function(List, ['foobar'])()[0]}
   call assert_equal('foobar', Extract())
 endfunc
+
+func Test_lambda_error()
+  " This was causing a crash
+  call assert_fails('ec{@{->{d->()()', 'E15')
+endfunc
index d4a677c797a155517af5c1e5feb3756b7ae8efc9..1d6d323bc5a78c537a077ab0ef34ccad538f0422 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2412,
 /**/
     2411,
 /**/