mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.4065: computation overflow with large cound for :yank
Problem: Computation overflow with large cound for :yank. Solution: Avoid an overflow.
This commit is contained in:
@@ -2374,6 +2374,9 @@ do_one_cmd(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ea.line1 = ea.line2;
|
ea.line1 = ea.line2;
|
||||||
|
if (ea.line2 >= LONG_MAX - (n - 1))
|
||||||
|
ea.line2 = LONG_MAX; // avoid overflow
|
||||||
|
else
|
||||||
ea.line2 += n - 1;
|
ea.line2 += n - 1;
|
||||||
++ea.addr_count;
|
++ea.addr_count;
|
||||||
/*
|
/*
|
||||||
|
@@ -704,9 +704,14 @@ func Test_address_line_overflow()
|
|||||||
throw 'Skipped: only works with 64 bit long ints'
|
throw 'Skipped: only works with 64 bit long ints'
|
||||||
endif
|
endif
|
||||||
new
|
new
|
||||||
call setline(1, 'text')
|
call setline(1, range(100))
|
||||||
call assert_fails('|.44444444444444444444444', 'E1247:')
|
call assert_fails('|.44444444444444444444444', 'E1247:')
|
||||||
call assert_fails('|.9223372036854775806', 'E1247:')
|
call assert_fails('|.9223372036854775806', 'E1247:')
|
||||||
|
|
||||||
|
$
|
||||||
|
yank 77777777777777777777
|
||||||
|
call assert_equal("99\n", @")
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4065,
|
||||||
/**/
|
/**/
|
||||||
4064,
|
4064,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user