Patch 9.0.0260
Problem:    Using freed memory when using 'quickfixtextfunc' recursively.
Solution:   Do not allow for recursion.
Files:      src/quickfix.c, src/testdir/test_quickfix.vim


*** ../vim-9.0.0259/src/quickfix.c      2022-08-14 14:16:07.999582175 +0100
--- src/quickfix.c      2022-08-24 20:05:42.090238828 +0100
***************
*** 4674,4679 ****
--- 4674,4684 ----
  {
      callback_T        *cb = &qftf_cb;
      list_T    *qftf_list = NULL;
+     static int        recursive = FALSE;
+ 
+     if (recursive)
+       return NULL;  // this doesn't work properly recursively
+     recursive = TRUE;
  
      // If 'quickfixtextfunc' is set, then use the user-supplied function to 
get
      // the text to display. Use the local value of 'quickfixtextfunc' if it is
***************
*** 4688,4694 ****
--- 4693,4702 ----
  
        // create the dict argument
        if ((d = dict_alloc_lock(VAR_FIXED)) == NULL)
+       {
+           recursive = FALSE;
            return NULL;
+       }
        dict_add_number(d, "quickfix", (long)IS_QF_LIST(qfl));
        dict_add_number(d, "winid", (long)qf_winid);
        dict_add_number(d, "id", (long)qfl->qf_id);
***************
*** 4711,4716 ****
--- 4719,4725 ----
        dict_unref(d);
      }
  
+     recursive = FALSE;
      return qftf_list;
  }
  
*** ../vim-9.0.0259/src/testdir/test_quickfix.vim       2022-07-28 
11:55:58.331052848 +0100
--- src/testdir/test_quickfix.vim       2022-08-24 20:03:05.493528061 +0100
***************
*** 6351,6354 ****
--- 6351,6367 ----
    %bw!
  endfunc
  
+ func Test_quickfixtextfunc_recursive()
+   func s:QFTfunc(o)
+     cgete '0'
+   endfunc
+   copen
+   let &quickfixtextfunc = 's:QFTfunc'
+   cex ""
+ 
+   let &quickfixtextfunc = ''
+   cclose
+ endfunc
+ 
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.0259/src/version.c       2022-08-24 19:27:41.648667087 +0100
--- src/version.c       2022-08-24 20:04:16.465883862 +0100
***************
*** 733,734 ****
--- 733,736 ----
  {   /* Add new patch number below this line */
+ /**/
+     260,
  /**/

-- 
Sorry, no fortune today.

 /// 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/20220824190758.ADE681C0D30%40moolenaar.net.

Raspunde prin e-mail lui