mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
Merge pull request #30205 from neovim/backport-30204-to-release-0.10
vim-patch:9.1.0707: [security]: invalid cursor position may cause a crash
This commit is contained in:
commit
8aea03f7b2
@ -512,7 +512,7 @@ static int virt_text_cursor_off(const CharsizeArg *csarg, bool on_NUL)
|
||||
void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end)
|
||||
{
|
||||
char *const line = ml_get_buf(wp->w_buffer, pos->lnum); // start of the line
|
||||
int const end_col = pos->col;
|
||||
colnr_T const end_col = pos->col;
|
||||
|
||||
CharsizeArg csarg;
|
||||
bool on_NUL = false;
|
||||
@ -556,6 +556,10 @@ void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *en
|
||||
}
|
||||
}
|
||||
|
||||
if (*ci.ptr == NUL && end_col < MAXCOL && end_col > ci.ptr - line) {
|
||||
pos->col = (colnr_T)(ci.ptr - line);
|
||||
}
|
||||
|
||||
int head = char_size.head;
|
||||
int incr = char_size.width;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user