Patch 8.2.4975
Problem:    Recursive command line loop may cause a crash.
Solution:   Limit recursion of getcmdline().
Files:      src/ex_getln.c, src/testdir/test_cmdline.vim


*** ../vim-8.2.4974/src/ex_getln.c      2022-05-09 20:09:19.286641426 +0100
--- src/ex_getln.c      2022-05-17 20:09:39.776412509 +0100
***************
*** 1581,1586 ****
--- 1581,1587 ----
      int               indent,         // indent for inside conditionals
      int               clear_ccline)   // clear ccline first
  {
+     static int        depth = 0;          // call depth
      int               c;
      int               i;
      int               j;
***************
*** 1611,1616 ****
--- 1612,1620 ----
      int               cmdline_type;
      int               wild_type;
  
+     // one recursion level deeper
+     ++depth;
+ 
      if (ccline.cmdbuff != NULL)
      {
        // Being called recursively.  Since ccline is global, we need to save
***************
*** 1641,1646 ****
--- 1645,1657 ----
      if (init_ccline(firstc, indent) != OK)
        goto theend;    // out of memory
  
+     if (depth == 50)
+     {
+       // Somehow got into a loop recursively calling getcmdline(), bail out.
+       emsg(_(e_command_too_recursive));
+       goto theend;
+     }
+ 
      ExpandInit(&xpc);
      ccline.xpc = &xpc;
  
***************
*** 2576,2581 ****
--- 2587,2593 ----
      {
        char_u *p = ccline.cmdbuff;
  
+       --depth;
        if (did_save_ccline)
            restore_cmdline(&save_ccline);
        else
*** ../vim-8.2.4974/src/testdir/test_cmdline.vim        2022-05-07 
12:48:24.074194794 +0100
--- src/testdir/test_cmdline.vim        2022-05-17 20:08:50.816443748 +0100
***************
*** 3392,3395 ****
--- 3392,3407 ----
    call feedkeys(":let a\<C-R>=Check_completion()\<CR>\<Esc>", "xt")
  endfunc
  
+ func Test_recursive_register()
+   let @= = ''
+   silent! ? e /
+   let caught = 'no'
+   try
+     normal / / 
+   catch /E169:/
+     let caught = 'yes'
+   endtry
+   call assert_equal('yes', caught)
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.4974/src/version.c       2022-05-17 17:47:02.084506580 +0100
--- src/version.c       2022-05-17 19:51:54.325092314 +0100
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4975,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
224. You set up your own Web page. You set up a Web page for each
     of your kids... and your pets.

 /// 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/20220517191601.6AC331C030A%40moolenaar.net.

Raspunde prin e-mail lui