comparison 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
comparison
equal deleted inserted replaced
18282:e0cbdb1aeca0 18283:0cb608fc9c60
4639 } 4639 }
4640 4640
4641 #ifdef FEAT_JOB_CHANNEL 4641 #ifdef FEAT_JOB_CHANNEL
4642 entering_window(curwin); 4642 entering_window(curwin);
4643 #endif 4643 #endif
4644 // Careful: autocommands may close the window and make "wp" invalid
4644 if (trigger_new_autocmds) 4645 if (trigger_new_autocmds)
4645 apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf); 4646 apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf);
4646 if (trigger_enter_autocmds) 4647 if (trigger_enter_autocmds)
4647 { 4648 {
4648 apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf); 4649 apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
4653 #ifdef FEAT_TITLE 4654 #ifdef FEAT_TITLE
4654 maketitle(); 4655 maketitle();
4655 #endif 4656 #endif
4656 curwin->w_redr_status = TRUE; 4657 curwin->w_redr_status = TRUE;
4657 #ifdef FEAT_TERMINAL 4658 #ifdef FEAT_TERMINAL
4658 if (bt_terminal(wp->w_buffer)) 4659 if (bt_terminal(curwin->w_buffer))
4659 // terminal is likely in another mode 4660 // terminal is likely in another mode
4660 redraw_mode = TRUE; 4661 redraw_mode = TRUE;
4661 #endif 4662 #endif
4662 redraw_tabline = TRUE; 4663 redraw_tabline = TRUE;
4663 if (restart_edit) 4664 if (restart_edit)