Patch 8.2.3492
Problem:    Crash when pasting too many times.
Solution:   Limit the size to what fits in an int. (closes #8962)
Files:      src/register.c, src/errors.h, src/testdir/test_put.vim


*** ../vim-8.2.3491/src/register.c      2021-09-22 15:43:54.021305851 +0100
--- src/register.c      2021-10-10 12:33:42.977999367 +0100
***************
*** 2011,2018 ****
            }
  
            do {
!               totlen = count * yanklen;
!               if (totlen > 0)
                {
                    oldp = ml_get(lnum);
                    if (lnum > start_lnum)
--- 2011,2025 ----
            }
  
            do {
!               long multlen = count * yanklen;
! 
!               totlen = multlen;
!               if (totlen != multlen)
!               {
!                   emsg(_(e_resulting_text_too_long));
!                   break;
!               }
!               else if (totlen > 0)
                {
                    oldp = ml_get(lnum);
                    if (lnum > start_lnum)
*** ../vim-8.2.3491/src/errors.h        2021-09-14 16:53:39.316540671 +0100
--- src/errors.h        2021-10-10 12:19:01.061781250 +0100
***************
*** 664,666 ****
--- 664,668 ----
        INIT(= N_("E1238: Blob required for argument %d"));
  EXTERN char e_invalid_value_for_blob_nr[]
        INIT(= N_("E1239: Invalid value for blob: %d"));
+ EXTERN char e_resulting_text_too_long[]
+       INIT(= N_("E1240: Resulting text too long"));
*** ../vim-8.2.3491/src/testdir/test_put.vim    2021-09-22 15:43:54.021305851 
+0100
--- src/testdir/test_put.vim    2021-10-10 12:31:12.063896799 +0100
***************
*** 134,137 ****
--- 134,145 ----
    bwipe!
  endfunc
  
+ func Test_very_larg_count()
+   new
+   let @" = 'x'
+   call assert_fails('norm 44444444444444p', 'E1240:')
+   bwipe!
+ endfunc
+ 
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3491/src/version.c       2021-10-09 16:28:52.782895348 +0100
--- src/version.c       2021-10-10 12:34:28.338631830 +0100
***************
*** 759,760 ****
--- 759,762 ----
  {   /* Add new patch number below this line */
+ /**/
+     3492,
  /**/

-- 
Statistics say that you can have a baby per month on average:
Just get nine women pregnant.

 /// 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/20211010113612.B7945C80054%40moolenaar.net.

Raspunde prin e-mail lui