diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-11-17 06:55:08 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-11-17 07:06:52 +0800 |
commit | d2f2e2725c6f8d3263516e7fdf7655ef1c379172 (patch) | |
tree | f12023a2810919779829b09940ae05f3df251dee /test | |
parent | a388c852c40682123698f1f55cefc426aa3f70e3 (diff) | |
download | rneovim-d2f2e2725c6f8d3263516e7fdf7655ef1c379172.tar.gz rneovim-d2f2e2725c6f8d3263516e7fdf7655ef1c379172.tar.bz2 rneovim-d2f2e2725c6f8d3263516e7fdf7655ef1c379172.zip |
vim-patch:9.0.1532: crash when expanding "~" in substitute causes very long text
Problem: Crash when expanding "~" in substitute causes very long text.
Solution: Limit the text length to MAXCOL.
https://github.com/vim/vim/commit/ab9a2d884b3a4abe319606ea95a5a6d6b01cd73a
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/test_substitute.vim | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/old/testdir/test_substitute.vim b/test/old/testdir/test_substitute.vim index 8dff0cda52..9f1adda3bf 100644 --- a/test/old/testdir/test_substitute.vim +++ b/test/old/testdir/test_substitute.vim @@ -1415,6 +1415,20 @@ func Test_substitute_short_cmd() bw! endfunc +" Check handling expanding "~" resulting in extremely long text. +func Test_substitute_tilde_too_long() + enew! + + s/.*/ixxx + s//~~~~~~~~~AAAAAAA@( + + " Either fails with "out of memory" or "text too long". + " This can take a long time. + call assert_fails('sil! norm &&&&&&&&&', ['E1240:\|E342:']) + + bwipe! +endfunc + " This should be done last to reveal a memory leak when vim_regsub_both() is " called to evaluate an expression but it is not used in a second call. func Test_z_substitute_expr_leak() |