comparison src/vim9compile.c @ 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 1d84eaed0ec8
children 63cc54100ae4
comparison
equal deleted inserted replaced
20173:027fa081b86d 20174:72b437855299
5820 */ 5820 */
5821 static char_u * 5821 static char_u *
5822 compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx) 5822 compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx)
5823 { 5823 {
5824 char_u *p; 5824 char_u *p;
5825 int has_expr; 5825 int has_expr = FALSE;
5826 5826
5827 if (cctx->ctx_skip == TRUE) 5827 if (cctx->ctx_skip == TRUE)
5828 goto theend; 5828 goto theend;
5829 5829
5830 has_expr = (excmd_get_argt(eap->cmdidx) & (EX_XFILE | EX_EXPAND)); 5830 if (eap->cmdidx >= 0 && eap->cmdidx < CMD_SIZE)
5831 has_expr = (excmd_get_argt(eap->cmdidx) & (EX_XFILE | EX_EXPAND));
5831 if (eap->cmdidx == CMD_syntax && STRNCMP(eap->arg, "include ", 8) == 0) 5832 if (eap->cmdidx == CMD_syntax && STRNCMP(eap->arg, "include ", 8) == 0)
5832 { 5833 {
5833 // expand filename in "syntax include [@group] filename" 5834 // expand filename in "syntax include [@group] filename"
5834 has_expr = TRUE; 5835 has_expr = TRUE;
5835 eap->arg = skipwhite(eap->arg + 7); 5836 eap->arg = skipwhite(eap->arg + 7);