Patch 8.2.3403 (after 8.2.3402)
Problem:    Memory leak for :retab with invalid argument.
Solution:   Free the memory.  Make error messages consistent.
Files:      src/indent.c


*** ../vim-8.2.3402/src/indent.c        2021-09-04 18:47:25.184668070 +0200
--- src/indent.c        2021-09-04 21:19:06.192166335 +0200
***************
*** 70,78 ****
--- 70,81 ----
      {
        int n = atoi((char *)cp);
  
+       // Catch negative values, overflow and ridiculous big values.
        if (n < 0 || n > 9999)
        {
            semsg(_(e_invarg2), cp);
+           vim_free(*array);
+           *array = NULL;
            return FAIL;
        }
        (*array)[t++] = n;
***************
*** 1615,1626 ****
      else
        new_ts_str = vim_strnsave(new_ts_str, eap->arg - new_ts_str);
  #else
!     new_ts = getdigits(&(eap->arg));
!     if (new_ts < 0)
      {
        emsg(_(e_positive));
        return;
      }
      if (new_ts == 0)
        new_ts = curbuf->b_p_ts;
  #endif
--- 1618,1635 ----
      else
        new_ts_str = vim_strnsave(new_ts_str, eap->arg - new_ts_str);
  #else
!     ptr = eap->arg;
!     new_ts = getdigits(&ptr);
!     if (new_ts < 0 && *eap->arg == '-')
      {
        emsg(_(e_positive));
        return;
      }
+     if (new_ts < 0 || new_ts > 9999)
+     {
+       semsg(_(e_invarg2), eap->arg);
+       return;
+     }
      if (new_ts == 0)
        new_ts = curbuf->b_p_ts;
  #endif
*** ../vim-8.2.3402/src/version.c       2021-09-04 18:47:25.184668070 +0200
--- src/version.c       2021-09-04 21:20:17.471944536 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3403,
  /**/

-- 
An alien life briefly visits earth.  Just before departing it leaves a
message in the dust on the back of a white van.  The world is shocked
and wants to know what it means.  After months of studies the worlds
best linguistic scientists are able to decipher the message: "Wash me!".

 /// 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/202109041928.184JSml6895946%40masaka.moolenaar.net.

Raspunde prin e-mail lui