comparison src/edit.c @ 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 e4c553e9132b
children 3b87daa5c37a
comparison
equal deleted inserted replaced
14456:e7009e1541f4 14457:893ac612569f
4417 ins_buf = curbuf; 4417 ins_buf = curbuf;
4418 e_cpt = (compl_cont_status & CONT_LOCAL) 4418 e_cpt = (compl_cont_status & CONT_LOCAL)
4419 ? (char_u *)"." : curbuf->b_p_cpt; 4419 ? (char_u *)"." : curbuf->b_p_cpt;
4420 last_match_pos = first_match_pos = *ini; 4420 last_match_pos = first_match_pos = *ini;
4421 } 4421 }
4422 else if (ins_buf != curbuf && !buf_valid(ins_buf))
4423 ins_buf = curbuf; // In case the buffer was wiped out.
4422 4424
4423 compl_old_match = compl_curr_match; /* remember the last current match */ 4425 compl_old_match = compl_curr_match; /* remember the last current match */
4424 pos = (compl_direction == FORWARD) ? &last_match_pos : &first_match_pos; 4426 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 */
4426 for (;;) 4431 for (;;)
4427 { 4432 {
4428 found_new_match = FAIL; 4433 found_new_match = FAIL;
4429 set_match_pos = FALSE; 4434 set_match_pos = FALSE;
4430 4435