changeset 14457:893ac612569f v8.1.0242

patch 8.1.0242: Insert mode completion may use an invalid buffer pointer commit https://github.com/vim/vim/commit/02ab97709d5c56fb7fe42e134bb9fc54f76a1f9f Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 7 14:55:09 2018 +0200 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 https://github.com/vim/vim/issues/3290)
author Christian Brabandt <cb@256bit.org>
date Tue, 07 Aug 2018 15:00:05 +0200
parents e7009e1541f4
children 929cbd7d2884
files src/edit.c src/version.c
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- a/src/version.c
+++ b/src/version.c
@@ -795,6 +795,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    242,
+/**/
     241,
 /**/
     240,