mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
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 #2532)
This commit is contained in:
parent
9e33efd152
commit
82846a00ac
@ -684,11 +684,11 @@ searchit(
|
|||||||
&& pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count
|
&& pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count
|
||||||
&& pos->col < MAXCOL - 2)
|
&& pos->col < MAXCOL - 2)
|
||||||
{
|
{
|
||||||
ptr = ml_get_buf(buf, pos->lnum, FALSE) + pos->col;
|
ptr = ml_get_buf(buf, pos->lnum, FALSE);
|
||||||
if (*ptr == NUL)
|
if ((int)STRLEN(ptr) < pos->col)
|
||||||
start_char_len = 1;
|
start_char_len = 1;
|
||||||
else
|
else
|
||||||
start_char_len = (*mb_ptr2len)(ptr);
|
start_char_len = (*mb_ptr2len)(ptr + pos->col);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
|
@ -152,3 +152,16 @@ func Test_match()
|
|||||||
call assert_equal(3 , match('abc', '\zs', 3, 1))
|
call assert_equal(3 , match('abc', '\zs', 3, 1))
|
||||||
call assert_equal(-1, match('abc', '\zs', 4, 1))
|
call assert_equal(-1, match('abc', '\zs', 4, 1))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" This was causing an illegal memory access
|
||||||
|
func Test_inner_tag()
|
||||||
|
new
|
||||||
|
norm ixxx
|
||||||
|
call feedkeys("v", 'xt')
|
||||||
|
insert
|
||||||
|
x
|
||||||
|
x
|
||||||
|
.
|
||||||
|
norm it
|
||||||
|
q!
|
||||||
|
endfunc
|
||||||
|
@ -771,6 +771,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1486,
|
||||||
/**/
|
/**/
|
||||||
1485,
|
1485,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user