diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-04-17 15:06:35 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-04-17 15:06:35 +0100 |
commit | 8b91e71441069b1dde9ac9ff9d9a829b1b4aecca (patch) | |
tree | 9b020a9e9ae446c5b11fb14399002fbcb5e99458 /src/eval.c | |
parent | a9549c9e8f368a7fa1dcbe14ec23e82c6a0b8715 (diff) | |
download | vim-git-8b91e71441069b1dde9ac9ff9d9a829b1b4aecca.tar.gz |
patch 8.2.4774: crash when using a number for lambda namev8.2.4774
Problem: Crash when using a number for lambda name.
Solution: Check the type of the lambda reference.
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/eval.c b/src/eval.c index cad688775..61b09fb6b 100644 --- a/src/eval.c +++ b/src/eval.c @@ -4102,19 +4102,23 @@ eval_lambda( ++*arg; ret = eval1(arg, rettv, evalarg); *arg = skipwhite_and_linebreak(*arg, evalarg); - if (**arg == ')') + if (**arg != ')') { - ++*arg; + emsg(_(e_missing_closing_paren)); + return FAIL; } - else + if (rettv->v_type != VAR_STRING && rettv->v_type != VAR_FUNC + && rettv->v_type != VAR_PARTIAL) { - emsg(_(e_missing_closing_paren)); - ret = FAIL; + emsg(_(e_string_or_function_required_for_arrow_parens_expr)); + return FAIL; } + ++*arg; } if (ret != OK) return FAIL; - else if (**arg != '(') + + if (**arg != '(') { if (verbose) { |