mirror of
https://github.com/neovim/neovim.git
synced 2026-04-22 07:15:34 +00:00
fix(api): buffer overflow in nvim_buf_get_extmarks overlap #37184
With `overlap=true`, more extmarks than the requested limit may be collected in `extmark_get`. This then leads to an out of bounds write of `rv` in `nvim_buf_get_extmarks`.
This commit is contained in:
committed by
GitHub
parent
a03ab03a10
commit
612cd99a00
@@ -817,6 +817,15 @@ describe('API/extmarks', function()
|
||||
get_extmarks(ns, { 2, 0 }, { 2, -1 }, { overlap = true })
|
||||
)
|
||||
end)
|
||||
|
||||
it('limits overlap results', function()
|
||||
set_extmark(ns, 1, 0, 0, { end_row = 5, end_col = 0 })
|
||||
set_extmark(ns, 2, 2, 5, { end_row = 2, end_col = 30 })
|
||||
set_extmark(ns, 3, 0, 5, { end_row = 2, end_col = 10 })
|
||||
set_extmark(ns, 4, 0, 0, { end_row = 1, end_col = 0 })
|
||||
local rv = get_extmarks(ns, { 2, 0 }, { 2, -1 }, { overlap = true, limit = 1 })
|
||||
eq(1, #rv)
|
||||
end)
|
||||
end)
|
||||
|
||||
it('replace works', function()
|
||||
|
||||
Reference in New Issue
Block a user