diff src/vim9compile.c @ 22423:5b35b477eff0 v8.2.1760

patch 8.2.1760: Vim9: crash when end marker is missing Commit: https://github.com/vim/vim/commit/2914a20abc78d4ace94d48d6e6ab9f0da894dd7e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Sep 27 18:24:03 2020 +0200 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 https://github.com/vim/vim/issues/7031)
author Bram Moolenaar <Bram@vim.org>
date Sun, 27 Sep 2020 18:30:03 +0200
parents 1cefe1c013ac
children 685909aa5641
line wrap: on
line diff
--- 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];