fix(highlight): ensure extmark range is within buffer bounds #35928

Adds an additional check for the case when end_col = 0, addressing
https://github.com/neovim/neovim/issues/35814#issuecomment-3340709532.

Validation is now localized to the highlighter without affecting the C API.
This commit is contained in:
skewb1k
2025-09-27 05:32:28 +03:00
committed by GitHub
parent a0c60e819d
commit e3c36f31e3
2 changed files with 17 additions and 13 deletions

View File

@@ -813,8 +813,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
len = opts->ephemeral ? MAXCOL : ml_get_buf_len(buf, (linenr_T)line2 + 1);
} else if (line2 == buf->b_ml.ml_line_count) {
// We are trying to add an extmark past final newline
// TODO(skewb1k): workaround for #35814. Investigate proper concurrency-safe handling of extmarks.
len = opts->ephemeral ? MAXCOL : 0;
len = 0;
} else {
// reuse len from before
line2 = (int)line;