From 02ab97709d5c56fb7fe42e134bb9fc54f76a1f9f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 7 Aug 2018 14:55:09 +0200 Subject: [PATCH] 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) --- src/edit.c | 7 ++++++- src/version.c | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/edit.c b/src/edit.c index daadc7b7b..45176d79f 100644 --- a/src/edit.c +++ b/src/edit.c @@ -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; diff --git a/src/version.c b/src/version.c index 6162752f2..5a263a93e 100644 --- a/src/version.c +++ b/src/version.c @@ -794,6 +794,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 242, /**/ 241, /**/ -- 2.50.1