Patch 8.2.4359
Problem:    crash when repeatedly using :retab.
Solution:   Bail out when the line is getting too long.
Files:      src/indent.c, src/testdir/test_retab.vim


*** ../vim-8.2.4358/src/indent.c        2022-02-05 11:12:59.962281668 +0000
--- src/indent.c        2022-02-12 15:35:30.269684683 +0000
***************
*** 1750,1755 ****
--- 1750,1760 ----
            if (ptr[col] == NUL)
                break;
            vcol += chartabsize(ptr + col, (colnr_T)vcol);
+           if (vcol >= MAXCOL)
+           {
+               emsg(_(e_resulting_text_too_long));
+               break;
+           }
            if (has_mbyte)
                col += (*mb_ptr2len)(ptr + col);
            else
*** ../vim-8.2.4358/src/testdir/test_retab.vim  2021-09-04 17:47:25.184668070 
+0100
--- src/testdir/test_retab.vim  2022-02-12 15:35:14.733707190 +0000
***************
*** 70,75 ****
--- 70,77 ----
    call assert_equal("    a       b        c    ",         Retab('!', 3))
    call assert_equal("    a       b        c    ",         Retab('',  5))
    call assert_equal("    a       b        c    ",         Retab('!', 5))
+ 
+   set tabstop& expandtab&
  endfunc
  
  func Test_retab_error()
***************
*** 80,83 ****
--- 82,102 ----
    call assert_fails('ret 80000000000000000000', 'E475:')
  endfunc
  
+ func Test_retab_endless()
+   new
+   call setline(1, "\t0\t")
+   let caught = 'no'
+   try
+     while 1
+       set ts=4000
+       retab 4
+     endwhile
+   catch /E1240/
+     let caught = 'yes'
+   endtry
+   bwipe!
+   set tabstop&
+ endfunc
+ 
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.4358/src/version.c       2022-02-12 14:23:14.047444006 +0000
--- src/version.c       2022-02-12 15:12:27.915810579 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4359,
  /**/

-- 
Give a man a computer program and you give him a headache,
but teach him to program computers and you give him the power
to create headaches for others for the rest of his life...
        R. B. Forest

 /// 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/20220212154257.80C951C0DFF%40moolenaar.net.

Raspunde prin e-mail lui