patch 9.1.2064: completion: segfault during file name completion

Commit: 
https://github.com/vim/vim/commit/4895ae8c0cd144c98cfb05e0162c2caac8f63c4c
Author: Girish Palya <[email protected]>
Date:   Thu Jan 8 19:56:40 2026 +0000

    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 <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/insexpand.c b/src/insexpand.c
index 30a89df96..4e3973a9a 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 000000000..a42bd9661
--- /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 b60f7c622..f839af77e 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, "\<CR>")
+  call term_sendkeys(buf, "iset ac cot=fuzzy,longest\<ESC>")
+  call term_sendkeys(buf, ":source\<CR>")
+  call term_sendkeys(buf, "o.na\<C-X>\<C-F>")  " 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 6caed54fa..b6a5fa5a1 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,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1vdwAw-0038xW-TF%40256bit.org.

Raspunde prin e-mail lui