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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/20221020150448.A2FCE1C17E4%40moolenaar.net.

Raspunde prin e-mail lui