Mercurial > vim
diff src/vim9compile.c @ 23658:c8f26523d7d7 v8.2.2371
patch 8.2.2371: Vim9: crash when using types in :for with unpack
Commit: https://github.com/vim/vim/commit/036d07144efe213199b1ed8de998e6f12a056499
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 17 20:23:38 2021 +0100
patch 8.2.2371: Vim9: crash when using types in :for with unpack
Problem: Vim9: crash when using types in :for with unpack.
Solution: Check for skip_var_list() failing. Pass include_type to
skip_var_one(). Skip type when compiling. (closes #7694)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 17 Jan 2021 20:30:03 +0100 |
parents | 8dcb2255ff9a |
children | c761fcb89dfe |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -6884,6 +6884,8 @@ compile_for(char_u *arg_start, cctx_T *c int idx; p = skip_var_list(arg_start, TRUE, &var_count, &semicolon, FALSE); + if (p == NULL) + return NULL; if (var_count == 0) var_count = 1; @@ -7018,6 +7020,8 @@ compile_for(char_u *arg_start, cctx_T *c generate_STORE(cctx, ISN_STORE, var_lvar->lv_idx, NULL); } + if (*p == ':') + p = skip_type(skipwhite(p + 1), FALSE); if (*p == ',' || *p == ';') ++p; arg = skipwhite(p);