From 6bc2d6b66b683faedded01128af8ad98b7130fef Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 15 Oct 2022 16:10:56 +0800 Subject: vim-patch:9.0.0614: SpellFileMissing autocmd may delete buffer Problem: SpellFileMissing autocmd may delete buffer. Solution: Disallow deleting the current buffer to avoid using freed memory. https://github.com/vim/vim/commit/ef976323e770315b5fca544efb6b2faa25674d15 --- src/nvim/testdir/test_autocmd.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index 025bda4515..63ed3ff435 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -2752,6 +2752,16 @@ func Test_FileType_spell() setglobal spellfile= endfunc +" this was wiping out the current buffer and using freed memory +func Test_SpellFileMissing_bwipe() + next 0 + au SpellFileMissing 0 bwipe + call assert_fails('set spell spelllang=0', 'E937:') + + au! SpellFileMissing + bwipe +endfunc + " Test closing a window or editing another buffer from a FileChangedRO handler " in a readonly buffer func Test_FileChangedRO_winclose() -- cgit