0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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 #7027)  Fix comment character.
This commit is contained in:
Bram Moolenaar
2020-09-27 14:22:48 +02:00
parent 8c7ad3631a
commit c0e29010f6
4 changed files with 17 additions and 2 deletions

View File

@@ -558,6 +558,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get)
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, int script_get)
}
// 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;