mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.1.0130: [security]: UAF if win_split_ins autocommands delete "wp"
Problem: heap-use-after-free in win_splitmove if Enter/Leave
autocommands from win_split_ins immediately closes "wp".
Solution: check that "wp" is valid after win_split_ins.
(Sean Dewar)
abf7030a5c
This commit is contained in:
parent
e3d4dfb6c3
commit
832bc5c169
@ -1948,8 +1948,8 @@ int win_splitmove(win_T *wp, int size, int flags)
|
||||
}
|
||||
|
||||
// If splitting horizontally, try to preserve height.
|
||||
// Note that win_split_ins autocommands may have immediately made "wp" floating!
|
||||
if (size == 0 && !(flags & WSP_VERT) && !wp->w_floating) {
|
||||
// Note that win_split_ins autocommands may have immediately closed "wp", or made it floating!
|
||||
if (size == 0 && !(flags & WSP_VERT) && win_valid(wp) && !wp->w_floating) {
|
||||
win_setheight_win(height, wp);
|
||||
if (p_ea) {
|
||||
// Equalize windows. Note that win_split_ins autocommands may have
|
||||
|
@ -1150,6 +1150,15 @@ func Test_win_splitmove()
|
||||
call assert_equal(v:true, s:triggered)
|
||||
unlet! s:triggered
|
||||
|
||||
split
|
||||
let close_win = winnr('#')
|
||||
augroup WinSplitMove
|
||||
au!
|
||||
au WinEnter * ++once quit!
|
||||
augroup END
|
||||
call win_splitmove(close_win, winnr())
|
||||
call assert_equal(0, win_id2win(close_win))
|
||||
|
||||
au! WinSplitMove
|
||||
augroup! WinSplitMove
|
||||
%bw!
|
||||
|
Loading…
Reference in New Issue
Block a user