mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
vim-patch:9.0.2106: [security]: Use-after-free in win_close()
Problem: [security]: Use-after-free in win_close()
Solution: Check window is valid, before accessing it
If the current window structure is no longer valid (because a previous
autocommand has already freed this window), fail and return before
attempting to set win->w_closing variable.
Add a test to trigger ASAN in CI
25aabc2b8e
Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -2661,6 +2661,9 @@ int win_close(win_T *win, bool free_buf, bool force)
|
||||
reset_VIsual_and_resel(); // stop Visual mode
|
||||
|
||||
other_buffer = true;
|
||||
if (!win_valid(win)) {
|
||||
return FAIL;
|
||||
}
|
||||
win->w_closing = true;
|
||||
apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, false, curbuf);
|
||||
if (!win_valid(win)) {
|
||||
|
Reference in New Issue
Block a user