summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-08-13 21:40:18 +0200
committerBram Moolenaar <Bram@vim.org>2020-08-13 21:40:18 +0200
commitcdd70f09a5340c3d7ae873f1aaaf9847f27410cc (patch)
treedda5a07f21b2c9ac88048c976fcac1c189c7dc8b
parentbe7529e8890f6e8a656efee8bc60c125dc8c2002 (diff)
downloadvim-git-cdd70f09a5340c3d7ae873f1aaaf9847f27410cc.tar.gz
patch 8.2.1443: Vim9: crash when interrupting a nested :def functionv8.2.1443
Problem: Vim9: crash when interrupting a nested :def function. Solution: Push a dummy return value onto the stack. (closes #6701)
-rw-r--r--src/version.c2
-rw-r--r--src/vim9execute.c17
2 files changed, 11 insertions, 8 deletions
diff --git a/src/version.c b/src/version.c
index 95337c70e..e2e6b2d3a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1443,
+/**/
1442,
/**/
1441,
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 8575e584a..98ae73358 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -915,16 +915,17 @@ call_def_function(
}
else
{
- // not inside try or need to return from current functions.
+ // Not inside try or need to return from current functions.
+ // Push a dummy return value.
+ if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
+ goto failed;
+ tv = STACK_TV_BOT(0);
+ tv->v_type = VAR_NUMBER;
+ tv->vval.v_number = 0;
+ ++ectx.ec_stack.ga_len;
if (ectx.ec_frame_idx == initial_frame_idx)
{
- // At the toplevel we are done. Push a dummy return value.
- if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
- goto failed;
- tv = STACK_TV_BOT(0);
- tv->v_type = VAR_NUMBER;
- tv->vval.v_number = 0;
- ++ectx.ec_stack.ga_len;
+ // At the toplevel we are done.
need_rethrow = TRUE;
if (handle_closure_in_use(&ectx, FALSE) == FAIL)
goto failed;