Patch 8.2.0381
Problem: Using freed memory with :lvimgrep and autocommand. (extracted from
POC by Dominique Pelle)
Solution: Avoid deleting a dummy buffer used in a window. (closes #5777)
Files: src/quickfix.c, src/testdir/test_quickfix.vim
*** ../vim-8.2.0380/src/quickfix.c 2020-02-21 21:30:33.871979710 +0100
--- src/quickfix.c 2020-03-14 17:14:21.565086331 +0100
***************
*** 6268,6274 ****
static void
wipe_dummy_buffer(buf_T *buf, char_u *dirname_start)
{
! if (curbuf != buf) // safety check
{
#if defined(FEAT_EVAL)
cleanup_T cs;
--- 6268,6293 ----
static void
wipe_dummy_buffer(buf_T *buf, char_u *dirname_start)
{
! // If any autocommand opened a window on the dummy buffer, close that
! // window. If we can't close them all then give up.
! while (buf->b_nwindows > 0)
! {
! int did_one = FALSE;
! win_T *wp;
!
! if (firstwin->w_next != NULL)
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
! if (wp->w_buffer == buf)
! {
! if (win_close(wp, FALSE) == OK)
! did_one = TRUE;
! break;
! }
! if (!did_one)
! return;
! }
!
! if (curbuf != buf && buf->b_nwindows == 0) // safety check
{
#if defined(FEAT_EVAL)
cleanup_T cs;
*** ../vim-8.2.0380/src/testdir/test_quickfix.vim 2020-02-21
17:54:41.830235712 +0100
--- src/testdir/test_quickfix.vim 2020-03-14 17:15:39.208786913 +0100
***************
*** 3684,3689 ****
--- 3684,3697 ----
enew | only
endfunc
+ func Test_lvimgrep_crash2()
+ au BufNewFile x sfind
+ call assert_fails('lvimgrep x x', 'E480:')
+ call assert_fails('lvimgrep x x x', 'E480:')
+
+ au! BufNewFile
+ endfunc
+
" Test for the position of the quickfix and location list window
func Test_qfwin_pos()
" Open two windows
*** ../vim-8.2.0380/src/version.c 2020-03-14 15:27:52.442171431 +0100
--- src/version.c 2020-03-14 17:17:58.184250044 +0100
***************
*** 740,741 ****
--- 740,743 ----
{ /* Add new patch number below this line */
+ /**/
+ 381,
/**/
--
hundred-and-one symptoms of being an internet addict:
256. You are able to write down over 250 symptoms of being an internet
addict, even though they only asked for 101.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202003141623.02EGN20V019235%40masaka.moolenaar.net.