patch 8.2.2802: Vim9: illegal memory access
Problem: Vim9: illegal memory access.
Solution: Check for comment before checking for white space. (closes #8142)
diff --git a/src/eval.c b/src/eval.c
index a9f5ae6..fbf4f57 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2083,7 +2083,8 @@
* 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 @@
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;