diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-04-23 19:32:23 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-04-23 19:32:23 +0200 |
commit | a6aa16423fdd0518ec9f3074b0d32b1d651d41e8 (patch) | |
tree | f73a51f60bdb365a5eb75c74af9c13afda09189c /src/eval.c | |
parent | f6d9935a13a7b37272ad71761d3d86b7f40c3d5f (diff) | |
download | vim-git-a6aa16423fdd0518ec9f3074b0d32b1d651d41e8.tar.gz |
patch 8.2.2802: Vim9: illegal memory accessv8.2.2802
Problem: Vim9: illegal memory access.
Solution: Check for comment before checking for white space. (closes #8142)
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c index a9f5ae65b..fbf4f57a5 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2083,7 +2083,8 @@ getline_peek_skip_comments(evalarg_T *evalarg) * If inside Vim9 script, "arg" points to the end of a line (ignoring a # * comment) and there is a next line, return the next line (skipping blanks) * and set "getnext". - * Otherwise just return "arg" unmodified and set "getnext" to FALSE. + * Otherwise return the next non-white at or after "arg" and set "getnext" to + * FALSE. * "arg" must point somewhere inside a line, not at the start. */ char_u * @@ -2095,7 +2096,7 @@ eval_next_non_blank(char_u *arg, evalarg_T *evalarg, int *getnext) if (in_vim9script() && evalarg != NULL && (evalarg->eval_cookie != NULL || evalarg->eval_cctx != NULL) - && (*p == NUL || (VIM_ISWHITE(p[-1]) && vim9_comment_start(p)))) + && (*p == NUL || (vim9_comment_start(p) && VIM_ISWHITE(p[-1])))) { char_u *next; |