From: Bram Moolenaar Date: Sat, 24 Jul 2021 11:18:48 +0000 (+0200) Subject: patch 8.2.3207: Vim9: crash when compiling string fails X-Git-Tag: v8.2.3207 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a234eb18e6e43408755bb24e813330306c11629;p=thirdparty%2Fvim.git patch 8.2.3207: Vim9: crash when compiling string fails Problem: Vim9: crash when compiling string fails. (Yegappan Lakshmanan) Solution: Adjust the type stack length. --- diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index 0d765cc256..6b64823f5f 100644 --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -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 diff --git a/src/version.c b/src/version.c index 7375563913..387a6e66ca 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 */ +/**/ + 3207, /**/ 3206, /**/ diff --git a/src/vim9compile.c b/src/vim9compile.c index fada1346b7..06098d84c5 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -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; }