]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.3207: Vim9: crash when compiling string fails v8.2.3207
authorBram Moolenaar <Bram@vim.org>
Sat, 24 Jul 2021 11:18:48 +0000 (13:18 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 24 Jul 2021 11:18:48 +0000 (13:18 +0200)
Problem:    Vim9: crash when compiling string fails. (Yegappan Lakshmanan)
Solution:   Adjust the type stack length.

src/testdir/test_vim9_builtin.vim
src/version.c
src/vim9compile.c

index 0d765cc2566754c054817b16d269a2a0ab5388d1..6b64823f5f1dbe993e1b77444b9904b96a581100 100644 (file)
@@ -2566,8 +2566,13 @@ def Test_searchpair()
   END
   CheckScriptSuccess(lines)
   assert_equal('yes', g:caught)
-
   unlet g:caught
+
+  lines =<< trim END
+      echo searchpair("a", "b", "c", "d", "1", "f")
+  END
+  CheckDefAndScriptFailure2(lines, 'E1001:', 'E475:')
+
   bwipe!
 enddef
 
index 73755639130af68c5c03d5ef0277d028db369c64..387a6e66ca00ed16713206ba5c39f1b283b037ad 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3207,
 /**/
     3206,
 /**/
index fada1346b78f708243b4e8a82f5166b62d903ce3..06098d84c509086e54b081485aae5c7b7687e646 100644 (file)
@@ -3263,6 +3263,7 @@ compile_string(isn_T *isn, cctx_T *cctx)
            semsg(_(e_trailing_arg), s);
        clear_instr_ga(&cctx->ctx_instr);
        cctx->ctx_instr = save_ga;
+       ++cctx->ctx_type_stack.ga_len;
        return FAIL;
     }