From: Bram Moolenaar Date: Sun, 26 Apr 2020 12:29:56 +0000 (+0200) Subject: patch 8.2.0642: Vim9: using invalid index X-Git-Tag: v8.2.0642 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d41aa8874a62eb399e13b94add7f0e5c4dd074b;p=vim patch 8.2.0642: Vim9: using invalid index Problem: Vim9: using invalid index. Solution: Check index for being valid. Fix memory leak. --- diff --git a/src/clientserver.c b/src/clientserver.c index 524542580..cf35c8149 100644 --- 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) diff --git a/src/version.c b/src/version.c index 3829af5b3..590c39217 100644 --- a/src/version.c +++ b/src/version.c @@ -746,6 +746,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 642, /**/ 641, /**/ diff --git a/src/vim9compile.c b/src/vim9compile.c index ccd73f77f..0e9abac0e 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -5822,12 +5822,13 @@ compile_mult_expr(char_u *arg, int cmdidx, cctx_T *cctx) 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"