diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2026-01-14 09:43:48 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2026-01-14 13:56:01 +0800 |
| commit | 40fb2818b636b4d069a5bf6d16dff5d0f62a1775 (patch) | |
| tree | 59fa304a9e078c0ddb10986a1805df8b8346970e /test/functional/vimscript/executable_spec.lua | |
| parent | 6fa2ebec6b244eea8dde01ca72deeebd4546e537 (diff) | |
| download | rneovim-40fb2818b636b4d069a5bf6d16dff5d0f62a1775.tar.gz rneovim-40fb2818b636b4d069a5bf6d16dff5d0f62a1775.tar.bz2 rneovim-40fb2818b636b4d069a5bf6d16dff5d0f62a1775.zip | |
vim-patch:9.1.2085: Use-after-free in winframe_remove()
Problem: Use-after-free in winframe_remove() (henices)
Solution: Set window_layout_locked() inside winframe_remove()
and check that writing diff files is disallowed when the
window layout is locked.
It can happen with a custom diff expression when removing a window:
1. Buffer was removed, so win_frame_remove() is called to remove the
window.
2. win_frame_remove() → frame_new_height() → scroll_to_fraction()
→ diff_check_fill() (checks for filler lines)
3. diff_check_fill() ends up causing a diff_try_update, and because we
are not using internal diff, it has to first write the file to a
buffer using buf_write()
4. buf_write() is called for a buffer that is not contained within a
window, so it first calls aucmd_prepbuf() to create a new temporary
window before writing the buffer and then later calls
aucmd_restbuf(), which restores the previous window layout, calling
winframe_remove() again, which will free the window/frame structure,
eventually freeing stuff that will still be accessed at step 2.
closes: vim/vim#19064
https://github.com/vim/vim/commit/ead1dda74a485ef0470e7252d07c1a36b8cde517
Nvim doesn't have this bug as Nvim uses a floating window as autocommand
window, and removing it doesn't need winframe_remove().
Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'test/functional/vimscript/executable_spec.lua')
0 files changed, 0 insertions, 0 deletions