Skip to content

Commit faf29d7

Browse files
committed
patch 8.0.0703: illegal memory access with empty :doau command
Problem: Illegal memory access with empty :doau command. Solution: Check the event for being out of range. (James McCoy)
1 parent c577d81 commit faf29d7

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/fileio.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8863,7 +8863,7 @@ do_doautocmd(
88638863
/*
88648864
* Loop over the events.
88658865
*/
8866-
while (*arg && !VIM_ISWHITE(*arg))
8866+
while (*arg && !ends_excmd(*arg) && !VIM_ISWHITE(*arg))
88678867
if (apply_autocmds_group(event_name2nr(arg, &arg),
88688868
fname, NULL, TRUE, group, curbuf, NULL))
88698869
nothing_done = FALSE;
@@ -9385,7 +9385,8 @@ apply_autocmds_group(
93859385
* Quickly return if there are no autocommands for this event or
93869386
* autocommands are blocked.
93879387
*/
9388-
if (first_autopat[(int)event] == NULL || autocmd_blocked > 0)
9388+
if (event == NUM_EVENTS || first_autopat[(int)event] == NULL
9389+
|| autocmd_blocked > 0)
93899390
goto BYPASS_AU;
93909391

93919392
/*
@@ -9458,7 +9459,7 @@ apply_autocmds_group(
94589459
{
94599460
if (event == EVENT_COLORSCHEME || event == EVENT_OPTIONSET)
94609461
autocmd_fname = NULL;
9461-
else if (fname != NULL && *fname != NUL)
9462+
else if (fname != NULL && !ends_excmd(*fname))
94629463
autocmd_fname = fname;
94639464
else if (buf != NULL)
94649465
autocmd_fname = buf->b_ffname;

src/testdir/test_autocmd.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,3 +418,7 @@ function Test_autocmd_bufwipe_in_SessLoadPost2()
418418
call delete(file)
419419
endfor
420420
endfunc
421+
422+
func Test_empty_doau()
423+
doau \|
424+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
703,
767769
/**/
768770
702,
769771
/**/

0 commit comments

Comments
 (0)