diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-22 22:48:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-22 22:48:55 +0800 |
commit | b84a67f50ed6141f72d433094a1a611ae4f67924 (patch) | |
tree | 489d51091837a31218e6634910a81ff65e225b2d /test | |
parent | e34eb4ccf9c3a9c04127cb8e00742ed2e3316484 (diff) | |
download | rneovim-b84a67f50ed6141f72d433094a1a611ae4f67924.tar.gz rneovim-b84a67f50ed6141f72d433094a1a611ae4f67924.tar.bz2 rneovim-b84a67f50ed6141f72d433094a1a611ae4f67924.zip |
vim-patch:9.0.0579: using freed memory when 'tagfunc' wipes out buffer (#24838)
Problem: Using freed memory when 'tagfunc' wipes out buffer that holds
'complete'.
Solution: Make a copy of the option. Make sure cursor position is valid.
https://github.com/vim/vim/commit/0ff01835a40f549c5c4a550502f62a2ac9ac447c
Cherry-pick a cmdwin change from patch 9.0.0500.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ui/cmdline_spec.lua | 8 | ||||
-rw-r--r-- | test/functional/ui/popupmenu_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/ui/searchhl_spec.lua | 2 | ||||
-rw-r--r-- | test/old/testdir/test_ins_complete.vim | 20 |
4 files changed, 24 insertions, 8 deletions
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 7d87ba4972..4b92ab730d 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -316,7 +316,7 @@ local function test_cmdline(linegrid) screen:expect{grid=[[ | {2:[No Name] }| - {1::}make^ | + {1::}mak^e | {3:[Command Line] }| | ]]} @@ -326,7 +326,7 @@ local function test_cmdline(linegrid) screen:expect{grid=[[ | {2:[No Name] }| - {1::}make^ | + {1::}mak^e | {3:[Command Line] }| | ]], cmdline={nil, { @@ -339,7 +339,7 @@ local function test_cmdline(linegrid) screen:expect{grid=[[ | {2:[No Name] }| - {1::}make^ | + {1::}mak^e | {3:[Command Line] }| | ]], cmdline={nil, { @@ -352,7 +352,7 @@ local function test_cmdline(linegrid) screen:expect{grid=[[ | {2:[No Name] }| - {1::}make^ | + {1::}mak^e | {3:[Command Line] }| | ]]} diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 76038472bd..ea65cf35bd 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -3239,7 +3239,7 @@ describe('builtin popupmenu', function() | {3:[No Name] }| {1::}sign define | - {1::}sign define^ | + {1::}sign defin^e | {1:~ }| {1:~ }| {1:~ }| diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index ec1ebbe4ca..7fd66d6f8a 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -52,7 +52,7 @@ describe('search highlighting', function() {1:~ }| /text^ | ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 9, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 8, linecount = 2, sum_scroll_delta = 0}; }} end) diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index f01a95b6fe..d9b2abffab 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -645,9 +645,8 @@ func Test_pum_with_preview_win() call writefile(lines, 'Xpreviewscript') let buf = RunVimInTerminal('-S Xpreviewscript', #{rows: 12}) - call TermWait(buf, 50) call term_sendkeys(buf, "Gi\<C-X>\<C-O>") - call TermWait(buf, 100) + call TermWait(buf, 200) call term_sendkeys(buf, "\<C-N>") call VerifyScreenDump(buf, 'Test_pum_with_preview_win', {}) @@ -2237,4 +2236,21 @@ func Test_ins_complete_end_of_line() bwipe! endfunc +func s:Tagfunc(t,f,o) + bwipe! + return [] +endfunc + +" This was using freed memory, since 'complete' was in a wiped out buffer. +" Also using a window that was closed. +func Test_tagfunc_wipes_out_buffer() + new + set complete=.,t,w,b,u,i + se tagfunc=s:Tagfunc + sil norm i + + bwipe! +endfunc + + " vim: shiftwidth=2 sts=2 expandtab |