]> granicus.if.org Git - vim/commitdiff
patch 8.1.0242: Insert mode completion may use an invalid buffer pointer v8.1.0242
authorBram Moolenaar <Bram@vim.org>
Tue, 7 Aug 2018 12:55:09 +0000 (14:55 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 7 Aug 2018 12:55:09 +0000 (14:55 +0200)
Problem:    Insert mode completion may use an invalid buffer pointer.
Solution:   Check for ins_buf to be valid. (closes #3290)

src/edit.c
src/version.c

index daadc7b7b078945bbfc81745a2e873cbe2b9e088..45176d79f497272d56326c39134e6338ba41cd61 100644 (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;
index 6162752f20891d782bcfdfea38fba885ad6c2b54..5a263a93e0449c0fb0ae98de4a9313ce078dcd0a 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    242,
 /**/
     241,
 /**/