Patch 8.2.2463
Problem:    Using :arglocal in an autocommand may use freed memory.
            (houyunsong)
Solution:   Check if the arglist is locked.
Files:      src/arglist.c, src/testdir/test_autocmd.vim


*** ../vim-8.2.2462/src/arglist.c       2021-01-30 18:09:02.723958488 +0100
--- src/arglist.c       2021-02-03 21:20:28.712103030 +0100
***************
*** 557,562 ****
--- 557,564 ----
  
      if (eap->cmdidx != CMD_args)
      {
+       if (check_arglist_locked() == FAIL)
+           return;
        alist_unlink(ALIST(curwin));
        if (eap->cmdidx == CMD_argglobal)
            ALIST(curwin) = &global_alist;
***************
*** 566,571 ****
--- 568,575 ----
  
      if (*eap->arg != NUL)
      {
+       if (check_arglist_locked() == FAIL)
+           return;
        // ":args file ..": define new argument list, handle like ":next"
        // Also for ":argslocal file .." and ":argsglobal file ..".
        ex_next(eap);
*** ../vim-8.2.2462/src/testdir/test_autocmd.vim        2021-01-28 
14:24:51.181688004 +0100
--- src/testdir/test_autocmd.vim        2021-02-03 21:15:36.316965534 +0100
***************
*** 2717,2720 ****
--- 2717,2729 ----
    %bwipe!
  endfunc
  
+ " This was using freed memory.
+ func Test_BufNew_arglocal()
+   arglocal
+   au BufNew * arglocal
+   call assert_fails('drop xx', 'E1156:')
+ 
+   au! BufNew
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2462/src/version.c       2021-02-03 20:14:18.903555669 +0100
--- src/version.c       2021-02-03 21:21:32.935913500 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2463,
  /**/

-- 
I'd like to meet the man who invented sex and see what he's working on now.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202102032023.113KNvdN1863696%40masaka.moolenaar.net.

Raspunde prin e-mail lui