summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-10-11 21:19:13 +0200
committerBram Moolenaar <Bram@vim.org>2019-10-11 21:19:13 +0200
commitec66c41d84e574baf8009dbc0bd088d2bc5b2421 (patch)
treeef666f19b084bab73d530bcf7eb370780f33be21 /src/window.c
parent00eab7f128ecfef699fec30988e5b1cc72378617 (diff)
downloadvim-git-ec66c41d84e574baf8009dbc0bd088d2bc5b2421.tar.gz
patch 8.1.2136: using freed memory with autocmd from fuzzerv8.1.2136
Problem: using freed memory with autocmd from fuzzer. (Dhiraj Mishra, Dominique Pelle) Solution: Avoid using "wp" after autocommands. (closes #5041)
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/window.c b/src/window.c
index 0fda9f05c..fb8a5a7ed 100644
--- 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