To: vim_dev@googlegroups.com Subject: Patch 8.2.2463 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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 -- Bram@Moolenaar.net -- 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 ///