mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
vim-patch:8.1.2136: using freed memory with autocmd from fuzzer
Problem: using freed memory with autocmd from fuzzer. (Dhiraj Mishra, Dominique Pelle) Solution: Avoid using "wp" after autocommands. (closes vim/vim#5041)ec66c41d84
Nvim doesn't use Vim's terminal implementation. Despite this, Nvim has its own *exclusive* way of crashing here. Requires 'winwidth' > winwidth() and 'nowinfixwidth' to crash; adjust the test ('nowfw' is the default, but ensure its disabled anyway). (cherry picked from commitc366c944c2
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
ae249d81fb
commit
a0ebba7052
@@ -1897,6 +1897,17 @@ func Test_autocmd_CmdWinEnter()
|
|||||||
call delete(filename)
|
call delete(filename)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_autocmd_was_using_freed_memory()
|
||||||
|
pedit xx
|
||||||
|
n x
|
||||||
|
au WinEnter * quit
|
||||||
|
" Nvim needs large 'winwidth' and 'nowinfixwidth' to crash
|
||||||
|
set winwidth=99999 nowinfixwidth
|
||||||
|
split
|
||||||
|
au! WinEnter
|
||||||
|
set winwidth& winfixwidth&
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_FileChangedShell_reload()
|
func Test_FileChangedShell_reload()
|
||||||
if !has('unix')
|
if !has('unix')
|
||||||
return
|
return
|
||||||
|
@@ -4525,6 +4525,7 @@ static void win_enter_ext(win_T *const wp, const int flags)
|
|||||||
|
|
||||||
fix_current_dir();
|
fix_current_dir();
|
||||||
|
|
||||||
|
// Careful: autocommands may close the window and make "wp" invalid
|
||||||
if (flags & WEE_TRIGGER_NEW_AUTOCMDS) {
|
if (flags & WEE_TRIGGER_NEW_AUTOCMDS) {
|
||||||
apply_autocmds(EVENT_WINNEW, NULL, NULL, false, curbuf);
|
apply_autocmds(EVENT_WINNEW, NULL, NULL, false, curbuf);
|
||||||
}
|
}
|
||||||
@@ -4558,7 +4559,7 @@ static void win_enter_ext(win_T *const wp, const int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set window width to desired minimal value
|
// set window width to desired minimal value
|
||||||
if (curwin->w_width < p_wiw && !curwin->w_p_wfw && !wp->w_floating) {
|
if (curwin->w_width < p_wiw && !curwin->w_p_wfw && !curwin->w_floating) {
|
||||||
win_setwidth((int)p_wiw);
|
win_setwidth((int)p_wiw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user