diff options
| author | Sébastien Hoffmann <hoffmannsd@gmail.com> | 2026-06-13 19:57:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-06-13 13:57:01 -0400 |
| commit | e36659c82f6d51631cf6a88a92ff2b467a078b18 (patch) | |
| tree | a3c4de85ed7491560b7aa1ee13ead7e015e28e7e /test/functional/vimscript/executable_spec.lua | |
| parent | e9b9426d7d1fa5aeb0451bf21b4a5515b4ef5901 (diff) | |
| download | rneovim-e36659c82f6d51631cf6a88a92ff2b467a078b18.tar.gz rneovim-e36659c82f6d51631cf6a88a92ff2b467a078b18.tar.bz2 rneovim-e36659c82f6d51631cf6a88a92ff2b467a078b18.zip | |
fix(statusline): prevent various buffer overflows with item groups #40219
Problem:
Various out-of-bounds writes inherited from vim (examples assume MAXPATHL==4096):
- truncated item groups where minwid>maxwid:
nvim --clean +"set 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:
nvim --clean +"set fillchars+=stl:∙ stl=%<%{%repeat('x',4096-3)%}%-2(X%)"
wrongly leads to padding at the end of the statusline and `out_p-out==4097`
because the bounds check assumes a 1-byte fillchar
- right-aligned item groups with 1-byte fillchar:
nvim --clean +"set 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:
nvim --clean +"set 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 Neovim,
nvim --clean +"set fillchars+=stl:∙ stl=%<%{%repeat('x',4096-149)%}%50(X%)"
Solution:
Clearer variable names and no recycling of variables for different purposes.
Diffstat (limited to 'test/functional/vimscript/executable_spec.lua')
0 files changed, 0 insertions, 0 deletions