Patch 9.0.0805

10 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 20, 2022, 11:05:02 AM10/20/22
to vim...@googlegroups.com

Patch 9.0.0805
Problem: Filetype autocmd may cause freed memory access.
Solution: Set the quickfix-busy flag while filling the buffer.
Files: src/quickfix.c, src/testdir/test_quickfix.vim


*** ../vim-9.0.0804/src/quickfix.c 2022-10-16 11:30:44.436748727 +0100
--- src/quickfix.c 2022-10-20 16:00:53.694204466 +0100
***************
*** 4595,4600 ****
--- 4595,4603 ----
qf_winid = win->w_id;
}

+ // autocommands may cause trouble
+ incr_quickfix_busy();
+
if (old_last == NULL)
// set curwin/curbuf to buf and save a few things
aucmd_prepbuf(&aco, buf);
***************
*** 4616,4621 ****
--- 4619,4627 ----
// when the added lines are not visible.
if ((win = qf_find_win(qi)) != NULL && old_line_count < win->w_botline)
redraw_buf_later(buf, UPD_NOT_VALID);
+
+ // always called after incr_quickfix_busy()
+ decr_quickfix_busy();
}
}

*** ../vim-9.0.0804/src/testdir/test_quickfix.vim 2022-10-13 11:59:18.845930012 +0100
--- src/testdir/test_quickfix.vim 2022-10-20 15:57:46.481697194 +0100
***************
*** 3455,3460 ****
--- 3455,3475 ----
endtry
endfunc

+ func Test_filetype_autocmd()
+ " this changes the location list while it is in use to fill a buffer
+ lexpr ''
+ lopen
+ augroup FT_loclist
+ au FileType * call setloclist(0, [], 'f')
+ augroup END
+ silent! lolder
+ lexpr ''
+
+ augroup FT_loclist
+ au! FileType
+ augroup END
+ endfunc
+
func Test_vimgrep_with_textlock()
new

***************
*** 6372,6375 ****
--- 6387,6391 ----
call setqflist([], 'f')
endfunc

+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.0804/src/version.c 2022-10-20 14:17:14.620460233 +0100
--- src/version.c 2022-10-20 15:54:07.520887102 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 805,
/**/

--
Mushrooms always grow in damp places and so they look like umbrellas.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages