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 -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///