]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.2064: completion: segfault during file name completion v9.1.2064
authorGirish Palya <girishji@gmail.com>
Thu, 8 Jan 2026 19:56:40 +0000 (19:56 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 8 Jan 2026 19:56:40 +0000 (19:56 +0000)
Problem:  completion: segfault during file name completion
Solution: Initialize compl_num_bests (Girish Palya)

closes: #19134

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/insexpand.c
src/testdir/dumps/Test_fuzzy_filenames_compl_autocompl.dump [new file with mode: 0644]
src/testdir/test_ins_complete.vim
src/version.c

index 30a89df96c820ed7e3dad89112d1e865dbdd9c90..4e3973a9a7929b7bfd252c43c725b77cc80b294a 100644 (file)
@@ -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 (file)
index 0000000..a42bd96
--- /dev/null
@@ -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
index b60f7c62234adc1009fee80c61b7d6e298a34fac..f839af77efd3d394c88d64e231e13d92108b925a 100644 (file)
@@ -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
index 6caed54fa2c93edc219073ee2c0a2a668cecdab6..b6a5fa5a178ed8b3c9d7081dbd18a9bfe7e904b9 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2064,
 /**/
     2063,
 /**/