From: Girish Palya Date: Thu, 8 Jan 2026 19:56:40 +0000 (+0000) Subject: patch 9.1.2064: completion: segfault during file name completion X-Git-Tag: v9.1.2064^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4895ae8c0cd144c98cfb05e0162c2caac8f63c4c;p=thirdparty%2Fvim.git patch 9.1.2064: completion: segfault during file name completion Problem: completion: segfault during file name completion Solution: Initialize compl_num_bests (Girish Palya) closes: #19134 Signed-off-by: Girish Palya Signed-off-by: Christian Brabandt --- diff --git a/src/insexpand.c b/src/insexpand.c index 30a89df96c..4e3973a9a7 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -7210,6 +7210,7 @@ ins_complete(int c, int enable_pum) compl_curr_buf = curwin->w_buffer; compl_shown_match = compl_curr_match; compl_shows_dir = compl_direction; + compl_num_bests = 0; // Find next match (and following matches). save_w_wrow = curwin->w_wrow; diff --git a/src/testdir/dumps/Test_fuzzy_filenames_compl_autocompl.dump b/src/testdir/dumps/Test_fuzzy_filenames_compl_autocompl.dump new file mode 100644 index 0000000000..a42bd9661f --- /dev/null +++ b/src/testdir/dumps/Test_fuzzy_filenames_compl_autocompl.dump @@ -0,0 +1,10 @@ +|s+0&#ffffff0|e|t| |a|c| |c|o|t|=|f|u|z@1|y|,|l|o|n|g|e|s|t| @50 +|.|n|a> @71 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|-+2#0000000&@1| |F|i|l|e| |n|a|m|e| |c|o|m|p|l|e|t|i|o|n| |(|^|F|^|N|^|P|)| |P+0#ffffff16#e000002|a|t@1|e|r|n| |n|o|t| |f|o|u|n|d| +0#0000000#ffffff0@24 diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index b60f7c6223..f839af77ef 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -6155,4 +6155,24 @@ func Test_longest_preinsert_accept() call test_override("char_avail", 0) endfunc +" Issue 19114 +func Test_fuzzy_filenames_compl_autocompl() + CheckScreendump + let dir = 'Xtempdir' + call mkdir(dir, 'pR') + call writefile([], dir .. '/.name') + call writefile([], dir .. '/name') + call writefile([], dir .. '/test.vim') + + let buf = RunVimInTerminal('', {'rows': 10}) + call term_sendkeys(buf, ':call test_override("char_avail", 1)') + call term_sendkeys(buf, "\") + call term_sendkeys(buf, "iset ac cot=fuzzy,longest\") + call term_sendkeys(buf, ":source\") + call term_sendkeys(buf, "o.na\\") " this used to cause segfault + call TermWait(buf, 200) + call VerifyScreenDump(buf, 'Test_fuzzy_filenames_compl_autocompl', {}) + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab nofoldenable diff --git a/src/version.c b/src/version.c index 6caed54fa2..b6a5fa5a17 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2064, /**/ 2063, /**/