comparison 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
comparison
equal deleted inserted replaced
23842:cfb7e7e26037 23843:d97258eca25d
555 { 555 {
556 int i; 556 int i;
557 557
558 if (eap->cmdidx != CMD_args) 558 if (eap->cmdidx != CMD_args)
559 { 559 {
560 if (check_arglist_locked() == FAIL)
561 return;
560 alist_unlink(ALIST(curwin)); 562 alist_unlink(ALIST(curwin));
561 if (eap->cmdidx == CMD_argglobal) 563 if (eap->cmdidx == CMD_argglobal)
562 ALIST(curwin) = &global_alist; 564 ALIST(curwin) = &global_alist;
563 else // eap->cmdidx == CMD_arglocal 565 else // eap->cmdidx == CMD_arglocal
564 alist_new(); 566 alist_new();
565 } 567 }
566 568
567 if (*eap->arg != NUL) 569 if (*eap->arg != NUL)
568 { 570 {
571 if (check_arglist_locked() == FAIL)
572 return;
569 // ":args file ..": define new argument list, handle like ":next" 573 // ":args file ..": define new argument list, handle like ":next"
570 // Also for ":argslocal file .." and ":argsglobal file ..". 574 // Also for ":argslocal file .." and ":argsglobal file ..".
571 ex_next(eap); 575 ex_next(eap);
572 } 576 }
573 else if (eap->cmdidx == CMD_args) 577 else if (eap->cmdidx == CMD_args)