Commit: patch 9.1.1528: completion: crash with getcompletion()

3 views
Skip to first unread message

Christian Brabandt

unread,
Jul 8, 2025, 4:15:13 PM7/8/25
to vim...@googlegroups.com
patch 9.1.1528: completion: crash with getcompletion()

Commit: https://github.com/vim/vim/commit/f2ec8d4afc0623a477d198c42994544190b4e427
Author: Christian Brabandt <c...@256bit.org>
Date: Tue Jul 8 22:04:10 2025 +0200

patch 9.1.1528: completion: crash with getcompletion()

Problem: completion: crash with getcompletion()
(zeertzjq)
Solution: Don't set may_expand_pattern in f_getcompletion(),
unset may_expand_pattern() once it is not longer needed
(Girish Palya).

fixes: #17680
closes: #17686

Signed-off-by: Girish Palya <giri...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/cmdexpand.c b/src/cmdexpand.c
index 75efe1c62..bdfa67945 100644
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -233,7 +233,6 @@ nextwild(

if (xp->xp_numfiles == -1)
{
- may_expand_pattern = options & WILD_MAY_EXPAND_PATTERN;
pre_incsearch_pos = xp->xp_pre_incsearch_pos;
#ifdef FEAT_EVAL
if (ccline->input_fn && ccline->xp_context == EXPAND_COMMANDS)
@@ -244,7 +243,9 @@ nextwild(
else
#endif
{
+ may_expand_pattern = options & WILD_MAY_EXPAND_PATTERN;
set_expand_context(xp);
+ may_expand_pattern = FALSE;
}
cmd_showtail = expand_showtail(xp);
}
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 47adb2b08..46ace6616 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -4478,7 +4478,7 @@ func Test_search_complete()
call feedkeys("gg/Fo\<tab>\<f9>", 'tx')
call assert_equal(['Foobar', 'FooBARR'], g:compl_info.matches)
call feedkeys("gg/FO\<tab>\<f9>", 'tx')
- call assert_equal({}, g:compl_info)
+ call assert_equal({}, g:compl_info)
call feedkeys("gg/\cFo\<tab>\<f9>", 'tx')
call assert_equal(['

Christian Brabandt

unread,
Jul 8, 2025, 4:27:04 PM7/8/25
to vim...@googlegroups.com

Hi,

On Di, 08 Jul 2025, Christian Brabandt wrote:

> patch 9.1.1528: completion: crash with getcompletion()
>
> Commit: https://github.com/vim/vim/commit/f2ec8d4afc0623a477d198c42994544190b4e427
> Author: Christian Brabandt <c...@256bit.org>
> Date: Tue Jul 8 22:04:10 2025 +0200
>
[...]
> diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
> index 47adb2b08..46ace6616 100644
> --- a/src/testdir/test_cmdline.vim
> +++ b/src/testdir/test_cmdline.vim
> @@ -4478,7 +4478,7 @@ func Test_search_complete()
> call feedkeys("gg/Fo\<tab>\<f9>", 'tx')
> call assert_equal(['Foobar', 'FooBARR'], g:compl_info.matches)
> call feedkeys("gg/FO\<tab>\<f9>", 'tx')
> - call assert_equal({}, g:compl_info)
> + call assert_equal({}, g:compl_info)
> call feedkeys("gg/\cFo\<tab>\<f9>", 'tx')
> call assert_equal(['

Somehow we lost the rest of the patch.
The rest of the patch is available at:
https://github.com/vim/vim/commit/f2ec8d4afc0623a477d198c42994544190b4e427

Thanks,
Christian
--
I do not know myself and God forbid that I should.
-- Johann Wolfgang von Goethe
Reply all
Reply to author
Forward
0 new messages