Mercurial > vim
diff src/window.c @ 18283:0cb608fc9c60 v8.1.2136
patch 8.1.2136: using freed memory with autocmd from fuzzer
Commit: https://github.com/vim/vim/commit/ec66c41d84e574baf8009dbc0bd088d2bc5b2421
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Oct 11 21:19:13 2019 +0200
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 #5041)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 11 Oct 2019 21:30:04 +0200 |
parents | 3f51e026de28 |
children | 9f51d0cef8da |
line wrap: on
line diff
--- a/src/window.c +++ b/src/window.c @@ -4641,6 +4641,7 @@ win_enter_ext( #ifdef FEAT_JOB_CHANNEL entering_window(curwin); #endif + // Careful: autocommands may close the window and make "wp" invalid if (trigger_new_autocmds) apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf); if (trigger_enter_autocmds) @@ -4655,7 +4656,7 @@ win_enter_ext( #endif curwin->w_redr_status = TRUE; #ifdef FEAT_TERMINAL - if (bt_terminal(wp->w_buffer)) + if (bt_terminal(curwin->w_buffer)) // terminal is likely in another mode redraw_mode = TRUE; #endif