summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_autocmd.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-09-28 11:48:30 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-28 11:48:30 +0100
commitef976323e770315b5fca544efb6b2faa25674d15 (patch)
treebcbbeb67ecb9b2a445919e837089b682fd943d10 /src/testdir/test_autocmd.vim
parentcaa1d19da1cdfd07f93b578b4fd5214a53197cd6 (diff)
patch 9.0.0614: SpellFileMissing autocmd may delete bufferv9.0.0614
Problem: SpellFileMissing autocmd may delete buffer. Solution: Disallow deleting the current buffer to avoid using freed memory.
Diffstat (limited to 'src/testdir/test_autocmd.vim')
-rw-r--r--src/testdir/test_autocmd.vim10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index 86732f15db..70f0f553a2 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -2880,6 +2880,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()