diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2026-06-15 10:40:25 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-06-15 10:40:25 +0800 |
| commit | 63d89afc4c82a53b74bf16a02e0774bc199912bd (patch) | |
| tree | b6efe11ca72941621fa918e73cbf9ec019d62060 /test/functional/vimscript/executable_spec.lua | |
| parent | ff6930a6466c69466db5f9d2ba4b56e6c3e65d44 (diff) | |
| download | rneovim-63d89afc4c82a53b74bf16a02e0774bc199912bd.tar.gz rneovim-63d89afc4c82a53b74bf16a02e0774bc199912bd.tar.bz2 rneovim-63d89afc4c82a53b74bf16a02e0774bc199912bd.zip | |
vim-patch:9.2.0642: statusline: buffer overflow with item groups (#40253)
Problem: statusline: buffer overflow with item groups
Solution: Fix the issues (see below) (Sébastien Hoffmann)
Fix various buffer overflow bugs (examples assume MAXPATHL==4096):
- truncated item groups where minwid>maxwid:
vim --clean +"set ls=2 stl=%<%{%repeat('x',4096-11)%}%50.5(12🙂345%)"
leads to fillchars spilling over the end of the group/buffer while trying to
compensate for truncating at a multicell character because minwid<=maxwid is assumed
- left-aligned item groups with multi-byte fillchar:
vim --clean +"set ls=2 fillchars+=stl:∙ stl=%<%{%repeat('x',4096-3)%}%-2(X%)"
wrongly leads to padding at the end of the statusline and `p-out==4097`
because the bounds check assumes a 1-byte fillchar
- right-aligned item groups with 1-byte fillchar:
vim --clean +"set ls=2 stl=%<%{%repeat('x',4096-4)%}%4(XY%)"
leads to "YX" instead of "XY" at the end of the statusline
because `memmove` is done before adjusting the offset
- right-aligned item groups with multi-byte fillchar:
vim --clean +"set ls=2 fillchars+=stl:∙ stl=%5(X%)"
leads to "∙∙∙∙<e2>", i.e. the fillchar is being written over the group contents
and eventually being overwritten itself at the second byte with the final NUL,
because the padding counter assumes a 1-byte fillchar; to crash vim,
vim --clean +"set ls=2 fillchars+=stl:∙ stl=%<%{%repeat('x',4096-149)%}%50(X%)"
related: neovim/neovim#40219
closes: vim/vim#20522
https://github.com/vim/vim/commit/d249884340ca7d0e5edb02445101e88a280dac68
Co-authored-by: Sébastien Hoffmann <contact@shoffmann.dev>
Diffstat (limited to 'test/functional/vimscript/executable_spec.lua')
0 files changed, 0 insertions, 0 deletions