0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.1.0242: Insert mode completion may use an invalid buffer pointer

Problem:    Insert mode completion may use an invalid buffer pointer.
Solution:   Check for ins_buf to be valid. (closes #3290)
This commit is contained in:
Bram Moolenaar 2018-08-07 14:55:09 +02:00
parent 7cc596547a
commit 02ab97709d
2 changed files with 8 additions and 1 deletions

View File

@ -4419,10 +4419,15 @@ ins_compl_get_exp(pos_T *ini)
? (char_u *)"." : curbuf->b_p_cpt;
last_match_pos = first_match_pos = *ini;
}
else if (ins_buf != curbuf && !buf_valid(ins_buf))
ins_buf = curbuf; // In case the buffer was wiped out.
compl_old_match = compl_curr_match; /* remember the last current match */
pos = (compl_direction == FORWARD) ? &last_match_pos : &first_match_pos;
/* For ^N/^P loop over all the flags/windows/buffers in 'complete' */
/*
* For ^N/^P loop over all the flags/windows/buffers in 'complete'.
*/
for (;;)
{
found_new_match = FAIL;

View File

@ -794,6 +794,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
242,
/**/
241,
/**/