mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
fix(pum): fix heap-buffer-overflow with 'rightleft' (#33146)
This commit is contained in:
@@ -686,13 +686,13 @@ void pum_redraw(void)
|
||||
char *rt_start = rt;
|
||||
int cells = vim_strsize(rt);
|
||||
|
||||
if (cells > pum_width) {
|
||||
if (grid_col - cells < col_off - pum_width) {
|
||||
do {
|
||||
cells -= utf_ptr2cells(rt);
|
||||
MB_PTR_ADV(rt);
|
||||
} while (cells > pum_width);
|
||||
} while (grid_col - cells < col_off - pum_width);
|
||||
|
||||
if (cells < pum_width) {
|
||||
if (grid_col - cells > col_off - pum_width) {
|
||||
// Most left character requires 2-cells but only 1 cell is available on
|
||||
// screen. Put a '<' on the left of the pum item.
|
||||
*(--rt) = '<';
|
||||
|
Reference in New Issue
Block a user