I checked in 7.4.2321
==== Case 1 ====
How to reproduce:
- Create the following file:
$ cat sample1.vim
edit a.txt
augroup sample
autocmd!
autocmd BufUnload <buffer> tabfirst | 2bwipeout!
augroup END
edit b.txt
- Run vanilla Vim with above script file
$ vim -Nu NONE -S sample1.vim
Expected behavior:
SEGV does not occur.
Actual behavior:
SEGVed.
==== Case 2 ====
How to reproduce:
- Create the following file:
$ cat sample2.vim
setlocal buftype=nowrite
augroup sample
autocmd!
autocmd BufUnload <buffer> tabfirst | 2bwipeout
augroup END
normal! i1
edit a.txt
call feedkeys("\<CR>")
- Run vanilla Vim with above script file
$ vim -Nu NONE -S sample2.vim
Expected behavior:
SEGV does not occur.
Actual behavior:
SEGVed.
I know there are rare case and salicious scripts.
But, It is not good to SEGV.
I wrote a patch. --> `fix_autocmd_bufunload_with_bwipe.patch`
check it out.
I've also written test. --> `autocmd_bufunload_with_bwipe_test.patch`
Unfortunately, it did not SEGV in the pre-patch binary :-/
NOTE: This issue was reported by Norio Takagi. (Thanks!)
--
Best regards,
Hirohito Higashi (a.k.a. h_east)
2016-9-4(Sun) 21:33:17 UTC+9 h_east:
My patch also fixed the following case.
==== Case 3 ====
How to reproduce:
- Create the following file:
$ cat sample3.vim
tabedit
augroup sample
autocmd!
autocmd BufWinLeave <buffer> tabfirst
augroup END
:%!ls
edit! a.txt
normal! gt
:%!ls
call feedkeys("\<CR>q::q\<CR>")
- Run vanilla Vim with above script file
$ vim -Nu NONE -S sample3.vim
Expected behavior:
SEGV does not occur.
Actual behavior:
SEGVed.
Thanks.