diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-27 18:24:03 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-27 18:24:03 +0200 |
commit | 2914a20abc78d4ace94d48d6e6ab9f0da894dd7e (patch) | |
tree | 59070396b3a596283041c77e643125e29efd70bc | |
parent | 37ce6d3a6ab7c7864de6788feb67377e8bbffa63 (diff) | |
download | vim-git-8.2.1760.tar.gz |
patch 8.2.1760: Vim9: crash when end marker is missingv8.2.1760
Problem: Vim9: crash when end marker is missing. (Dhiraj Mishra)
Solution: Check for end of function lines. (closes #7031)
-rw-r--r-- | src/testdir/test_vim9_assign.vim | 16 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9compile.c | 2 |
3 files changed, 19 insertions, 1 deletions
diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim index 0a947346a..eddc8c5f3 100644 --- a/src/testdir/test_vim9_assign.vim +++ b/src/testdir/test_vim9_assign.vim @@ -740,6 +740,22 @@ def Test_heredoc() CheckDefFailure(['var lines =<< trim END X', 'END'], 'E488:') CheckDefFailure(['var lines =<< trim END " comment', 'END'], 'E488:') + + lines =<< trim [END] + def Func() + var&lines =<< trim END + x + x + x + x + x + x + x + x + enddef + call Func() + [END] + CheckScriptFailure(lines, 'E990:') enddef " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker diff --git a/src/version.c b/src/version.c index fe73a9271..7205343fb 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1760, +/**/ 1759, /**/ 1758, diff --git a/src/vim9compile.c b/src/vim9compile.c index d505ca670..e4f3a906e 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -4360,7 +4360,7 @@ exarg_getline( for (;;) { - if (cctx->ctx_lnum == cctx->ctx_ufunc->uf_lines.ga_len) + if (cctx->ctx_lnum >= cctx->ctx_ufunc->uf_lines.ga_len - 1) return NULL; ++cctx->ctx_lnum; p = ((char_u **)cctx->ctx_ufunc->uf_lines.ga_data)[cctx->ctx_lnum]; |