diff src/arglist.c @ 23843:d97258eca25d v8.2.2463

patch 8.2.2463: using :arglocal in an autocommand may use freed memory Commit: https://github.com/vim/vim/commit/6bcb877ec19a647443195a54eeac60cb693fd827 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 3 21:23:29 2021 +0100 patch 8.2.2463: using :arglocal in an autocommand may use freed memory Problem: Using :arglocal in an autocommand may use freed memory. (houyunsong) Solution: Check if the arglist is locked.
author Bram Moolenaar <Bram@vim.org>
date Wed, 03 Feb 2021 21:30:04 +0100
parents 8b682f6f3709
children 8f2262c72178
line wrap: on
line diff
--- a/src/arglist.c
+++ b/src/arglist.c
@@ -557,6 +557,8 @@ ex_args(exarg_T *eap)
 
     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,6 +568,8 @@ ex_args(exarg_T *eap)
 
     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);