changeset 20174:72b437855299 v8.2.0642

patch 8.2.0642: Vim9: using invalid index Commit: https://github.com/vim/vim/commit/7d41aa8874a62eb399e13b94add7f0e5c4dd074b Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 26 14:29:56 2020 +0200 patch 8.2.0642: Vim9: using invalid index Problem: Vim9: using invalid index. Solution: Check index for being valid. Fix memory leak.
author Bram Moolenaar <Bram@vim.org>
date Sun, 26 Apr 2020 14:45:04 +0200
parents 027fa081b86d
children 7029c9fbb3ff
files src/clientserver.c src/version.c src/vim9compile.c
diffstat 3 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/clientserver.c
+++ b/src/clientserver.c
@@ -473,6 +473,7 @@ cmdsrv_main(
 # ifdef FEAT_GUI_MSWIN
 		Shell_NotifyIcon(NIM_DELETE, &ni);
 # endif
+		vim_free(done);
 	    }
 	}
 	else if (STRICMP(argv[i], "--remote-expr") == 0)
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    642,
+/**/
     641,
 /**/
     640,
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -5822,12 +5822,13 @@ compile_mult_expr(char_u *arg, int cmdid
 compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx)
 {
     char_u  *p;
-    int	    has_expr;
+    int	    has_expr = FALSE;
 
     if (cctx->ctx_skip == TRUE)
 	goto theend;
 
-    has_expr = (excmd_get_argt(eap->cmdidx) & (EX_XFILE | EX_EXPAND));
+    if (eap->cmdidx >= 0 && eap->cmdidx < CMD_SIZE)
+	has_expr = (excmd_get_argt(eap->cmdidx) & (EX_XFILE | EX_EXPAND));
     if (eap->cmdidx == CMD_syntax && STRNCMP(eap->arg, "include ", 8) == 0)
     {
 	// expand filename in "syntax include [@group] filename"