0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.1760: Vim9: crash when end marker is missing

Problem:    Vim9: crash when end marker is missing. (Dhiraj Mishra)
Solution:   Check for end of function lines. (closes #7031)
This commit is contained in:
Bram Moolenaar
2020-09-27 18:24:03 +02:00
parent 37ce6d3a6a
commit 2914a20abc
3 changed files with 19 additions and 1 deletions

View File

@@ -740,6 +740,22 @@ def Test_heredoc()
CheckDefFailure(['var lines =<< trim END X', 'END'], 'E488:') CheckDefFailure(['var lines =<< trim END X', 'END'], 'E488:')
CheckDefFailure(['var lines =<< trim END " comment', '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 enddef
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1760,
/**/ /**/
1759, 1759,
/**/ /**/

View File

@@ -4360,7 +4360,7 @@ exarg_getline(
for (;;) 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; return NULL;
++cctx->ctx_lnum; ++cctx->ctx_lnum;
p = ((char_u **)cctx->ctx_ufunc->uf_lines.ga_data)[cctx->ctx_lnum]; p = ((char_u **)cctx->ctx_ufunc->uf_lines.ga_data)[cctx->ctx_lnum];