Patch 8.2.3675
Problem:    Using freed memory when vim_strsave() fails.
Solution:   Clear "last_sourcing_name".  Check for msg_source() called
            recursively. (closes #8217)
Files:      src/message.c


*** ../vim-8.2.3674/src/message.c       2021-11-25 13:39:22.591524947 +0000
--- src/message.c       2021-11-25 14:41:49.958792792 +0000
***************
*** 522,527 ****
--- 522,533 ----
  msg_source(int attr)
  {
      char_u    *p;
+     static int        recursive = FALSE;
+ 
+     // Bail out if something called here causes an error.
+     if (recursive)
+       return;
+     recursive = TRUE;
  
      ++no_wait_return;
      p = get_emsg_source();
***************
*** 541,553 ****
      // remember the last sourcing name printed, also when it's empty
      if (SOURCING_NAME == NULL || other_sourcing_name())
      {
!       vim_free(last_sourcing_name);
!       if (SOURCING_NAME == NULL)
!           last_sourcing_name = NULL;
!       else
            last_sourcing_name = vim_strsave(SOURCING_NAME);
      }
      --no_wait_return;
  }
  
  /*
--- 547,559 ----
      // remember the last sourcing name printed, also when it's empty
      if (SOURCING_NAME == NULL || other_sourcing_name())
      {
!       VIM_CLEAR(last_sourcing_name);
!       if (SOURCING_NAME != NULL)
            last_sourcing_name = vim_strsave(SOURCING_NAME);
      }
      --no_wait_return;
+ 
+     recursive = FALSE;
  }
  
  /*
*** ../vim-8.2.3674/src/version.c       2021-11-25 13:52:33.215676364 +0000
--- src/version.c       2021-11-25 14:42:50.786714484 +0000
***************
*** 759,760 ****
--- 759,762 ----
  {   /* Add new patch number below this line */
+ /**/
+     3675,
  /**/

-- 
<Beeth> Girls are like internet domain names,
        the ones I like are already taken.
<honx>  Well, you can stil get one from a strange country :-P

 /// 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/20211125144346.E53411C0A05%40moolenaar.net.

Raspunde prin e-mail lui