Mercurial > vim
diff src/evalvars.c @ 22413:66d1131a7eff v8.2.1755
patch 8.2.1755: Vim9: crash when using invalid heredoc marker
Commit: https://github.com/vim/vim/commit/c0e29010f68a0ebe439f9bd78493799c60b7bfd3
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 27 14:22:48 2020 +0200
patch 8.2.1755: Vim9: crash when using invalid heredoc marker
Problem: Vim9: crash when using invalid heredoc marker. (Dhiraj Mishra)
Solution: Check for NULL list. (closes https://github.com/vim/vim/issues/7027) Fix comment character.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 27 Sep 2020 14:30:04 +0200 |
parents | 5736172d64a6 |
children | 1cefe1c013ac |
line wrap: on
line diff
--- a/src/evalvars.c +++ b/src/evalvars.c @@ -558,6 +558,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, i int text_indent_len = 0; char_u *text_indent = NULL; char_u dot[] = "."; + int comment_char = in_vim9script() ? '#' : '"'; if (eap->getline == NULL) { @@ -585,11 +586,11 @@ heredoc_get(exarg_T *eap, char_u *cmd, i } // The marker is the next word. - if (*cmd != NUL && *cmd != '"') + if (*cmd != NUL && *cmd != comment_char) { marker = skipwhite(cmd); p = skiptowhite(marker); - if (*skipwhite(p) != NUL && *skipwhite(p) != '"') + if (*skipwhite(p) != NUL && *skipwhite(p) != comment_char) { semsg(_(e_trailing_arg), p); return NULL;