summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-08-21 15:26:54 +0200
committerBram Moolenaar <Bram@vim.org>2016-08-21 15:26:54 +0200
commit989f592f7ffcbafdc4ec35cee4dc65bd053e2077 (patch)
tree122c18af5dbbd1b69e025a7d0293ff0b55e4a93b /src/testdir
parentdd1248143e56b1450903fe40813e40c63691b071 (diff)
downloadvim-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.vim5
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',
\ '\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)',