fix: disallow removing extmarks in on_lines callbacks (#23219)

fix(extmarks): disallow removing extmarks in on_lines callbacks

decor_redraw_start (which runs before decor_providers_invoke_lines) gets
references for the extmarks on a specific line. If these extmarks are
deleted in on_lines callbacks then this results in a heap-use-after-free
error.

Fixes #22801
This commit is contained in:
Lewis Russell
2023-04-27 17:30:22 +01:00
committed by GitHub
parent 9f29176033
commit eb4676c67f
8 changed files with 67 additions and 9 deletions

View File

@@ -65,7 +65,7 @@ void bufhl_add_hl_pos_offset(buf_T *buf, int src_id, int hl_id, lpos_T pos_start
}
extmark_set(buf, (uint32_t)src_id, NULL,
(int)lnum - 1, hl_start, (int)lnum - 1 + end_off, hl_end,
&decor, true, false, kExtmarkNoUndo);
&decor, true, false, kExtmarkNoUndo, NULL);
}
}