diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-08-21 15:26:54 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-08-21 15:26:54 +0200 |
commit | 989f592f7ffcbafdc4ec35cee4dc65bd053e2077 (patch) | |
tree | 122c18af5dbbd1b69e025a7d0293ff0b55e4a93b /src/testdir | |
parent | dd1248143e56b1450903fe40813e40c63691b071 (diff) | |
download | vim-989f592f7ffcbafdc4ec35cee4dc65bd053e2077.zip |
patch 7.4.2235
Problem: submatch() does not check for a valid argument.
Solution: Give an error if the argument is out of range. (Dominique Pelle)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_expr.vim | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim index 76811255a..b23b4490b 100644 --- a/src/testdir/test_expr.vim +++ b/src/testdir/test_expr.vim @@ -198,6 +198,11 @@ func Test_substitute_expr() call assert_equal('--', substitute('xxx', 'x*', {-> '-' . Recurse() . '-'}, '')) endfunc +func Test_invalid_submatch() + " This was causing invalid memory access in Vim-7.4.2232 and older + call assert_fails("call substitute('x', '.', {-> submatch(10)}, '')", 'E935:') +endfunc + func Test_substitute_expr_arg() call assert_equal('123456789-123456789=', substitute('123456789', \ '\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', |