Patch 8.2.4065
Problem:    Computation overflow with large cound for :yank.
Solution:   Avoid an overflow.
Files:      src/ex_docmd.c, src/testdir/test_excmd.vim


*** ../vim-8.2.4064/src/ex_docmd.c      2022-01-08 16:19:18.501639918 +0000
--- src/ex_docmd.c      2022-01-11 19:32:00.245865281 +0000
***************
*** 2374,2380 ****
        else
        {
            ea.line1 = ea.line2;
!           ea.line2 += n - 1;
            ++ea.addr_count;
            /*
             * Be vi compatible: no error message for out of range.
--- 2374,2383 ----
        else
        {
            ea.line1 = ea.line2;
!           if (ea.line2 >= LONG_MAX - (n - 1))
!               ea.line2 = LONG_MAX;  // avoid overflow
!           else
!               ea.line2 += n - 1;
            ++ea.addr_count;
            /*
             * Be vi compatible: no error message for out of range.
*** ../vim-8.2.4064/src/testdir/test_excmd.vim  2021-12-31 12:19:18.739789858 
+0000
--- src/testdir/test_excmd.vim  2022-01-11 19:33:00.269697109 +0000
***************
*** 704,712 ****
      throw 'Skipped: only works with 64 bit long ints'
    endif
    new
!   call setline(1, 'text')
    call assert_fails('|.44444444444444444444444', 'E1247:')
    call assert_fails('|.9223372036854775806', 'E1247:')
    bwipe!
  endfunc
  
--- 704,717 ----
      throw 'Skipped: only works with 64 bit long ints'
    endif
    new
!   call setline(1, range(100))
    call assert_fails('|.44444444444444444444444', 'E1247:')
    call assert_fails('|.9223372036854775806', 'E1247:')
+ 
+   $
+   yank 77777777777777777777
+   call assert_equal("99\n", @")
+ 
    bwipe!
  endfunc
  
*** ../vim-8.2.4064/src/version.c       2022-01-11 18:14:17.934205651 +0000
--- src/version.c       2022-01-11 19:22:28.143599871 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4065,
  /**/

-- 
Facepalm statement #7: "Last week I almost got 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/20220111193454.585921C0573%40moolenaar.net.

Raspunde prin e-mail lui