vim-patch:8.2.4477: crash when using fuzzy completion

Problem:    Crash when using fuzzy completion.
Solution:   Temporary fix: put back regexp. (closes vim/vim#9851)

29ab6ce9f3

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2023-01-17 12:23:49 +08:00
parent 4c127f107a
commit bdd14d03c7

View File

@@ -2636,7 +2636,6 @@ static int ExpandFromContext(expand_T *xp, char *pat, char ***matches, int *numM
regmatch_T regmatch = { .rm_ic = false }; regmatch_T regmatch = { .rm_ic = false };
int ret; int ret;
int flags = map_wildopts_to_ewflags(options); int flags = map_wildopts_to_ewflags(options);
const bool fuzzy = cmdline_fuzzy_complete(pat);
if (xp->xp_context == EXPAND_FILES if (xp->xp_context == EXPAND_FILES
|| xp->xp_context == EXPAND_DIRECTORIES || xp->xp_context == EXPAND_DIRECTORIES
@@ -2717,7 +2716,6 @@ static int ExpandFromContext(expand_T *xp, char *pat, char ***matches, int *numM
return nlua_expand_pat(xp, pat, numMatches, matches); return nlua_expand_pat(xp, pat, numMatches, matches);
} }
if (!fuzzy) {
regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0); regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0);
if (regmatch.regprog == NULL) { if (regmatch.regprog == NULL) {
return FAIL; return FAIL;
@@ -2725,7 +2723,6 @@ static int ExpandFromContext(expand_T *xp, char *pat, char ***matches, int *numM
// set ignore-case according to p_ic, p_scs and pat // set ignore-case according to p_ic, p_scs and pat
regmatch.rm_ic = ignorecase(pat); regmatch.rm_ic = ignorecase(pat);
}
if (xp->xp_context == EXPAND_SETTINGS if (xp->xp_context == EXPAND_SETTINGS
|| xp->xp_context == EXPAND_BOOL_SETTINGS) { || xp->xp_context == EXPAND_BOOL_SETTINGS) {
@@ -2738,9 +2735,7 @@ static int ExpandFromContext(expand_T *xp, char *pat, char ***matches, int *numM
ret = ExpandOther(pat, xp, &regmatch, matches, numMatches); ret = ExpandOther(pat, xp, &regmatch, matches, numMatches);
} }
if (!fuzzy) {
vim_regfree(regmatch.regprog); vim_regfree(regmatch.regprog);
}
xfree(tofree); xfree(tofree);
return ret; return ret;