]> granicus.if.org Git - vim/commitdiff
patch 8.2.1443: Vim9: crash when interrupting a nested :def function v8.2.1443
authorBram Moolenaar <Bram@vim.org>
Thu, 13 Aug 2020 19:40:18 +0000 (21:40 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 13 Aug 2020 19:40:18 +0000 (21:40 +0200)
Problem:    Vim9: crash when interrupting a nested :def function.
Solution:   Push a dummy return value onto the stack. (closes #6701)

src/version.c
src/vim9execute.c

index 95337c70e191bb15f28fdedd68ea6bd7b33f9e03..e2e6b2d3a2744861748d90fd05447eeb8d406a74 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1443,
 /**/
     1442,
 /**/
index 8575e584a413e5a79bb7b1c01c552a4532591e75..98ae73358b0a4bcb8602a77d9fd49f6829f83750 100644 (file)
@@ -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;