diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-02-18 08:29:55 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2022-02-18 09:48:00 +0800 |
| commit | 3ed800e998e22a975e17ee54e675410148850c75 (patch) | |
| tree | f1c487fb51e6d589ec8c6ad504214d93b01d0146 /src/nvim/testdir | |
| parent | 592f4a7c0807427355635eb371215036325e5bb8 (diff) | |
| download | rneovim-3ed800e998e22a975e17ee54e675410148850c75.tar.gz rneovim-3ed800e998e22a975e17ee54e675410148850c75.tar.bz2 rneovim-3ed800e998e22a975e17ee54e675410148850c75.zip | |
vim-patch:8.2.3659: integer overflow with large line number
Problem: Integer overflow with large line number.
Solution: Check for overflow. (closes vim/vim#9202)
https://github.com/vim/vim/commit/03725c5795ae5b8c14da4a39cd0ce723c6dd4304
Put E1247 in globals.h as E1240 is also there.
Do not make getdigits() abort.
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_excmd.vim | 14 | ||||
| -rw-r--r-- | src/nvim/testdir/test_normal.vim | 21 |
2 files changed, 35 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_excmd.vim b/src/nvim/testdir/test_excmd.vim index bbf8b4dfc8..8055a51a11 100644 --- a/src/nvim/testdir/test_excmd.vim +++ b/src/nvim/testdir/test_excmd.vim @@ -409,4 +409,18 @@ func Test_not_break_expression_register() call assert_equal('1+1', getreg('=', 1)) endfunc +func Test_address_line_overflow() + throw 'Skipped: v:sizeoflong is N/A' " use legacy/excmd_spec.lua instead + + if v:sizeoflong < 8 + 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 + + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim index 5b7cf6fee5..e8eebb3fdd 100644 --- a/src/nvim/testdir/test_normal.vim +++ b/src/nvim/testdir/test_normal.vim @@ -2779,4 +2779,25 @@ func Test_normal_gj_on_extra_wide_char() bw! endfunc +func Test_normal_count_out_of_range() + new + call setline(1, 'text') + normal 44444444444| + call assert_equal(999999999, v:count) + normal 444444444444| + call assert_equal(999999999, v:count) + normal 4444444444444| + call assert_equal(999999999, v:count) + normal 4444444444444444444| + call assert_equal(999999999, v:count) + + normal 9y99999999| + call assert_equal(899999991, v:count) + normal 10y99999999| + call assert_equal(999999999, v:count) + normal 44444444444y44444444444| + call assert_equal(999999999, v:count) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |