]> granicus.if.org Git - vim/commitdiff
patch 8.2.0642: Vim9: using invalid index v8.2.0642
authorBram Moolenaar <Bram@vim.org>
Sun, 26 Apr 2020 12:29:56 +0000 (14:29 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 26 Apr 2020 12:29:56 +0000 (14:29 +0200)
Problem:    Vim9: using invalid index.
Solution:   Check index for being valid.  Fix memory leak.

src/clientserver.c
src/version.c
src/vim9compile.c

index 524542580345b2d6eb86e1f43da3f58e142c7a8f..cf35c8149f2ab1a84b7e67d4d11ef92cb93e9768 100644 (file)
@@ -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)
index 3829af5b3fc503a1596827ea593473f97f7512b0..590c392177b7570345501ca782aabd9fd05affc0 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    642,
 /**/
     641,
 /**/
index ccd73f77fa9fa026e005c0aad0b2f458b1982cef..0e9abac0e48a188e98428a386405c5338ffb0bf0 100644 (file)
@@ -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"