diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2026-05-10 08:06:07 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-10 08:06:07 +0800 |
| commit | 2d5f56c0aaded1d9fc903d93d55cbd07c5385ab1 (patch) | |
| tree | 02d41978a8ebaa39b3f0d9b9e35a1a3c06c08143 /runtime/lua/vim/loader.lua | |
| parent | b44c2bdd16226f6caa5324d91f1ae9781ffdc12b (diff) | |
| download | rneovim-2d5f56c0aaded1d9fc903d93d55cbd07c5385ab1.tar.gz rneovim-2d5f56c0aaded1d9fc903d93d55cbd07c5385ab1.tar.bz2 rneovim-2d5f56c0aaded1d9fc903d93d55cbd07c5385ab1.zip | |
vim-patch:9.2.0461: Corrupted undofile causes use-after-free (#39707)
Problem: The four pointer-resolution loops in u_read_undo() lack
an i != j guard, so a header whose uh_next.seq equals
its own uh_seq resolves uh_next.ptr to itself. On
buffer close, u_freeheader() sees uhp->uh_next.ptr !=
NULL and skips updating b_u_oldhead, so u_blockfree()
dereferences the freed header on the next iteration.
The same pattern applies to uh_prev, uh_alt_next and
uh_alt_prev. A crafted .un~ file in the same directory
as a text file can trigger the use-after-free and
subsequent double-free when the buffer is closed.
(Daniel Cervera)
Solution: Add an i != j guard to each of the four resolution
loops, matching the guard already present in the
duplicate-detection loop above.
closes: vim/vim#20168
Supported by AI
https://github.com/vim/vim/commit/4f610f07b76b4f34d011179c2531ab4517ac11e8
Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'runtime/lua/vim/loader.lua')
0 files changed, 0 insertions, 0 deletions