Patch 8.2.2802
Problem:    Vim9: illegal memory access.
Solution:   Check for comment before checking for white space. (closes #8142)
Files:      src/eval.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.2801/src/eval.c  2021-04-21 17:57:22.868103110 +0200
--- src/eval.c  2021-04-23 19:31:53.413938672 +0200
***************
*** 2083,2089 ****
   * 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.
   * "arg" must point somewhere inside a line, not at the start.
   */
      char_u *
--- 2083,2090 ----
   * 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 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,2101 ****
      if (in_vim9script()
            && evalarg != NULL
            && (evalarg->eval_cookie != NULL || evalarg->eval_cctx != NULL)
!           && (*p == NUL || (VIM_ISWHITE(p[-1]) && vim9_comment_start(p))))
      {
        char_u *next;
  
--- 2096,2102 ----
      if (in_vim9script()
            && evalarg != NULL
            && (evalarg->eval_cookie != NULL || evalarg->eval_cctx != NULL)
!           && (*p == NUL || (vim9_comment_start(p) && VIM_ISWHITE(p[-1]))))
      {
        char_u *next;
  
*** ../vim-8.2.2801/src/testdir/test_vim9_func.vim      2021-04-12 
22:02:32.308393464 +0200
--- src/testdir/test_vim9_func.vim      2021-04-23 19:30:00.562204419 +0200
***************
*** 2692,2696 ****
--- 2692,2706 ----
    CheckDefExecAndScriptFailure(lines, 'E1106: One argument too many', 1)
  enddef
  
+ def Test_closing_brace_at_start_of_line()
+   var lines =<< trim END
+       def Func()
+       enddef
+       Func(
+       )
+   END
+   call CheckDefAndScriptSuccess(lines)
+ enddef
+ 
  
  " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
*** ../vim-8.2.2801/src/version.c       2021-04-23 18:06:44.310238634 +0200
--- src/version.c       2021-04-23 19:27:27.862537005 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2802,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
164. You got out to buy software, instead of going out for a beer.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202104231904.13NJ4Nim1718490%40masaka.moolenaar.net.

Raspunde prin e-mail lui