1
0
forked from aniani/vim

patch 8.2.4477: crash when using fuzzy completion

Problem:    Crash when using fuzzy completion.
Solution:   Temporary fix: put back regexp. (closes #9851)
This commit is contained in:
Bram Moolenaar
2022-02-26 15:52:08 +00:00
parent c51cf03298
commit 29ab6ce9f3
2 changed files with 9 additions and 12 deletions

View File

@@ -2370,7 +2370,7 @@ get_mapclear_arg(expand_T *xp UNUSED, int idx)
static int static int
ExpandOther( ExpandOther(
char_u *pat, char_u *pat,
expand_T *xp, expand_T *xp,
regmatch_T *rmp, regmatch_T *rmp,
char_u ***matches, char_u ***matches,
int *numMatches) int *numMatches)
@@ -2496,7 +2496,6 @@ ExpandFromContext(
int ret; int ret;
int flags; int flags;
char_u *tofree = NULL; char_u *tofree = NULL;
int fuzzy = cmdline_fuzzy_complete(pat);
flags = map_wildopts_to_ewflags(options); flags = map_wildopts_to_ewflags(options);
@@ -2581,15 +2580,12 @@ ExpandFromContext(
pat = tofree; pat = tofree;
} }
if (!fuzzy) regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0);
{ if (regmatch.regprog == NULL)
regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0); return FAIL;
if (regmatch.regprog == NULL)
return FAIL;
// 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)
@@ -2603,8 +2599,7 @@ ExpandFromContext(
else else
ret = ExpandOther(pat, xp, &regmatch, matches, numMatches); ret = ExpandOther(pat, xp, &regmatch, matches, numMatches);
if (!fuzzy) vim_regfree(regmatch.regprog);
vim_regfree(regmatch.regprog);
vim_free(tofree); vim_free(tofree);
return ret; return ret;

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
4477,
/**/ /**/
4476, 4476,
/**/ /**/