mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 02:46:31 +00:00
vim-patch:8.0.1486: accessing invalid memory with "it"
Problem: Accessing invalid memory with "it". (Dominique Pelle)
Solution: Avoid going over the end of the line. (Christian Brabandt,
closes vim/vim#2532)
82846a00ac
This commit is contained in:
@@ -570,8 +570,12 @@ int searchit(
|
||||
&& pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count
|
||||
&& pos->col < MAXCOL - 2) {
|
||||
// Watch out for the "col" being MAXCOL - 2, used in a closed fold.
|
||||
ptr = ml_get_buf(buf, pos->lnum, false) + pos->col;
|
||||
start_char_len = *ptr == NUL ? 1 : (*mb_ptr2len)(ptr);
|
||||
ptr = ml_get_buf(buf, pos->lnum, false);
|
||||
if ((int)STRLEN(ptr) < pos->col) {
|
||||
start_char_len = 1;
|
||||
} else {
|
||||
start_char_len = utfc_ptr2len(ptr + pos->col);
|
||||
}
|
||||
} else {
|
||||
start_char_len = 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user