diff options
| author | Qatadaha Bin Matloob <79017227+qatcod@users.noreply.github.com> | 2026-09-27 20:04:11 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-27 11:04:11 -0400 |
| commit | c216c557fd76c762aa11486ed78e5897a96e6efc (patch) | |
| tree | a21537396aea8787d9dda5fbbb04eab247e3d1dd /runtime/lua/vim/provider/python.lua | |
| parent | 46d8548abd03b3d89c11679220dec7fd859d17ad (diff) | |
| download | rneovim-c216c557fd76c762aa11486ed78e5897a96e6efc.tar.gz rneovim-c216c557fd76c762aa11486ed78e5897a96e6efc.tar.bz2 rneovim-c216c557fd76c762aa11486ed78e5897a96e6efc.zip | |
fix(lua): str_byteindex() can return an index past the end #41766
Problem:
For an incomplete sequence at the end of the string, utf_ptr2len_len()
reports more bytes than are there, and mb_utf_index_to_bytes() returns
that position unclamped:
vim.str_byteindex('ab\xf0\x9f', 'utf-16', 3, false) --> 6
on a 4 byte string. LSP callers use the result as a column, so
nvim_buf_set_extmark() then fails with "Invalid 'col': out of range".
Solution:
Clamp the returned byte index to the length of the string.
AI-assisted
Diffstat (limited to 'runtime/lua/vim/provider/python.lua')
0 files changed, 0 insertions, 0 deletions