Skip to content

Commit 02ab977

Browse files
committed
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)
1 parent 7cc5965 commit 02ab977

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/edit.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4419,10 +4419,15 @@ ins_compl_get_exp(pos_T *ini)
44194419
? (char_u *)"." : curbuf->b_p_cpt;
44204420
last_match_pos = first_match_pos = *ini;
44214421
}
4422+
else if (ins_buf != curbuf && !buf_valid(ins_buf))
4423+
ins_buf = curbuf; // In case the buffer was wiped out.
44224424

44234425
compl_old_match = compl_curr_match; /* remember the last current match */
44244426
pos = (compl_direction == FORWARD) ? &last_match_pos : &first_match_pos;
4425-
/* For ^N/^P loop over all the flags/windows/buffers in 'complete' */
4427+
4428+
/*
4429+
* For ^N/^P loop over all the flags/windows/buffers in 'complete'.
4430+
*/
44264431
for (;;)
44274432
{
44284433
found_new_match = FAIL;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,8 @@ static char *(features[]) =
794794

795795
static int included_patches[] =
796796
{ /* Add new patch number below this line */
797+
/**/
798+
242,
797799
/**/
798800
241,
799801
/**/

0 commit comments

Comments
 (0)