patch 8.2.3847: illegal memory access when using a lambda with an error
Problem: Illegal memory access when using a lambda with an error.
Solution: Avoid skipping over the NUL after a string.
diff --git a/src/eval.c b/src/eval.c
index f45cd8e..ecc242d 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3871,12 +3871,15 @@
++*arg;
ret = eval1(arg, rettv, evalarg);
*arg = skipwhite_and_linebreak(*arg, evalarg);
- if (**arg != ')')
+ if (**arg == ')')
+ {
+ ++*arg;
+ }
+ else
{
emsg(_(e_missing_closing_paren));
ret = FAIL;
}
- ++*arg;
}
if (ret != OK)
return FAIL;
diff --git a/src/testdir/test_lambda.vim b/src/testdir/test_lambda.vim
index e173ea3..e6dcb67 100644
--- a/src/testdir/test_lambda.vim
+++ b/src/testdir/test_lambda.vim
@@ -64,6 +64,8 @@
call assert_fails('echo {a, a -> a + a}(1, 2)', 'E853:')
call assert_fails('echo {a, b -> a + b)}(1, 2)', 'E451:')
echo assert_fails('echo 10->{a -> a + 2}', 'E107:')
+
+ call assert_fails('eval 0->(', "E110: Missing ')'")
endfunc
func Test_not_lamda()
diff --git a/src/version.c b/src/version.c
index 92612d5..8ae0a86 100644
--- a/src/version.c
+++ b/src/version.c
@@ -750,6 +750,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3847,
+/**/
3846,
/**/
3845,