[vim/vim] Fix :bd/bun/bw attempting switch to closing buffer (PR #19107)

4 views
Skip to first unread message

Sean Dewar

unread,
Jan 6, 2026, 9:50:53 AM (3 days ago) Jan 6
to vim/vim, Subscribed

Problem: :bdelete/bunload/bwipeout may attempt to switch to a closing buffer, which fails. (after 9.1.2058)

Solution: don't consider switching to closing buffers.

Ugh. Silver lining is that before 9.1.2058 it could've instead been a UAF. 😁

Ref: neovim/neovim#37271 (comment)
TODO: needs tests


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/19107

Commit Summary

  • 1360f8e Fix :bd/bun/bw attempting switch to closing buffer

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19107@github.com>

Sean Dewar

unread,
Jan 6, 2026, 11:49:31 AM (3 days ago) Jan 6
to vim/vim, Push

@seandewar pushed 1 commit.

  • d811d14 Fix :bd/bun/bw attempting switch to closing buffer


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19107/before/1360f8e7b79e039b216965a93364d8283603ffd7/after/d811d1407408a17e6dad9b2b9b10eae3c1192711@github.com>

Sean Dewar

unread,
Jan 6, 2026, 12:42:27 PM (3 days ago) Jan 6
to vim/vim, Push

@seandewar pushed 1 commit.

  • 27c805f Fix :bd/bun/bw attempting switch to closing buffer

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19107/before/d811d1407408a17e6dad9b2b9b10eae3c1192711/after/27c805f88da384cd2b91ae9633186f8562e78fdb@github.com>

zeertzjq

unread,
Jan 7, 2026, 9:29:36 PM (2 days ago) Jan 7
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In src/testdir/test_buffer.vim:

> +          \| call assert_equal('bar', bufname())
+          \| bunload
+          \| call assert_equal('floob', bufname())
+  augroup END
+  buffer bazinga
+  buffer baz
+  buffer floob
+  buffer foo
+  buffer bar
+  noautocmd bdelete foo
+  clearjumps
+  bdelete bazinga
+  call assert_equal(6, s:fired)
+
+  unlet! s:fired
+  autocmd! SkipClosing
⬇️ Suggested change
-  autocmd! SkipClosing
+  autocmd! SkipClosing
+  augroup! SkipClosing


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19107/review/3637448117@github.com>

zeertzjq

unread,
Jan 7, 2026, 9:33:36 PM (2 days ago) Jan 7
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In src/testdir/test_buffer.vim:

> +          \| call assert_equal('bar', bufname())
+          \| bunload
+          \| call assert_equal('floob', bufname())
+  augroup END
+  buffer bazinga
+  buffer baz
+  buffer floob
+  buffer foo
+  buffer bar
+  noautocmd bdelete foo
+  clearjumps
+  bdelete bazinga
+  call assert_equal(6, s:fired)
+
+  unlet! s:fired
+  autocmd! SkipClosing

Actually this isn't really needed. There are many other tests that don't delete augroups.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19107/review/3637453808@github.com>

Christian Brabandt

unread,
Jan 8, 2026, 4:27:23 PM (yesterday) Jan 8
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19107)

thanks


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19107/c3725890008@github.com>

Christian Brabandt

unread,
Jan 8, 2026, 4:31:37 PM (yesterday) Jan 8
to vim/vim, Subscribed

Closed #19107 via 63d53de.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19107/issue_event/21933326995@github.com>

Reply all
Reply to author
Forward
0 new messages