From dcf7bc414037c888dbc4003caf9e28ffb0f7d4e2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 17 Apr 2022 03:54:28 +0800 Subject: vim-patch:8.2.4762: using freed memory using synstack() and synID() in WinEnter (#18136) Problem: Using freed memory when using synstack() and synID() in WinEnter. Solution: Check using the syntax window. (closes vim/vim#10204) https://github.com/vim/vim/commit/ca7e86c23789eb0ed8f6400f25ea9e0e1036f9fc --- src/nvim/testdir/test_syntax.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim index b047b53b6f..6bef61ae8f 100644 --- a/src/nvim/testdir/test_syntax.vim +++ b/src/nvim/testdir/test_syntax.vim @@ -794,5 +794,18 @@ func Test_syn_include_contains_TOP() bw! endfunc +" This was using freed memory +func Test_WinEnter_synstack_synID() + autocmd WinEnter * call synstack(line("."), col(".")) + autocmd WinEnter * call synID(line('.'), col('.') - 1, 1) + call setline(1, 'aaaaa') + normal! $ + new + close + + au! WinEnter + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit