diff options
| author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-03-18 01:15:27 -0400 |
|---|---|---|
| committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-04-13 12:00:32 -0400 |
| commit | 16a4581349f45f4030a4a361228bc1d69fb7e45f (patch) | |
| tree | baecf7f7cb62c50a3bbb6c2e0252b3e20a32292a /src/nvim/testdir | |
| parent | dbb386e1b277004e37902fd1c794727277312765 (diff) | |
| download | rneovim-16a4581349f45f4030a4a361228bc1d69fb7e45f.tar.gz rneovim-16a4581349f45f4030a4a361228bc1d69fb7e45f.tar.bz2 rneovim-16a4581349f45f4030a4a361228bc1d69fb7e45f.zip | |
vim-patch:8.1.2282: crash when passing many arguments through a partial
Problem: Crash when passing many arguments through a partial. (Andy
Massimino)
Solution: Check the number of arguments. (closes vim/vim#5186)
https://github.com/vim/vim/commit/4c054e9fb23027b55a09ee647a3a2c91936aeb1b
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_expr.vim | 2 | ||||
| -rw-r--r-- | src/nvim/testdir/test_substitute.vim | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_expr.vim b/src/nvim/testdir/test_expr.vim index dd546dbf71..264d8b000f 100644 --- a/src/nvim/testdir/test_expr.vim +++ b/src/nvim/testdir/test_expr.vim @@ -475,6 +475,8 @@ func Test_funcref() let OneByRef = funcref('One') call assert_equal(2, OneByRef()) call assert_fails('echo funcref("{")', 'E475:') + let OneByRef = funcref("One", repeat(["foo"], 20)) + call assert_fails('let OneByRef = funcref("One", repeat(["foo"], 21))', 'E118:') endfunc func Test_empty_concatenate() diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim index 25a8676b0c..ff07d8eceb 100644 --- a/src/nvim/testdir/test_substitute.vim +++ b/src/nvim/testdir/test_substitute.vim @@ -616,9 +616,20 @@ endfunc func SubReplacer(text, submatches) return a:text .. a:submatches[0] .. a:text endfunc +func SubReplacer20(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, submatches) + return a:t3 .. a:submatches[0] .. a:t11 +endfunc func Test_substitute_partial() - call assert_equal('1foo2foo3', substitute('123', '2', function('SubReplacer', ['foo']), 'g')) + call assert_equal('1foo2foo3', substitute('123', '2', function('SubReplacer', ['foo']), 'g')) + + " 19 arguments plus one is just OK + let Replacer = function('SubReplacer20', repeat(['foo'], 19)) + call assert_equal('1foo2foo3', substitute('123', '2', Replacer, 'g')) + + " 20 arguments plus one is too many + let Replacer = function('SubReplacer20', repeat(['foo'], 20)) + call assert_fails("call substitute('123', '2', Replacer, 'g')", 'E118') endfunc func Test_sub_cmd_9() |