Mercurial > vim
diff src/testdir/test_ins_complete.vim @ 30487:79e2d9b7780c v9.0.0579
patch 9.0.0579: using freed memory when 'tagfunc' wipes out buffer
Commit: https://github.com/vim/vim/commit/0ff01835a40f549c5c4a550502f62a2ac9ac447c
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 24 19:20:30 2022 +0100
patch 9.0.0579: using freed memory when 'tagfunc' wipes out buffer
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 24 Sep 2022 20:30:03 +0200 |
parents | 1928947b8e1a |
children | f08ed0738f7a |
line wrap: on
line diff
--- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -547,9 +547,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', {}) @@ -2172,4 +2171,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