mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +00:00
vim-patch:7.4.519
Problem: Crash when using syntax highlighting. Solution: When regprog is freed and replaced, store the result. https://github.com/vim/vim/tree/v7-4-519 Helped-by: Scott Prager <splinterofchaos@gmail.com>
This commit is contained in:

committed by
Justin M. Keyes

parent
4230f8c332
commit
b3519ca73b
@@ -1201,8 +1201,11 @@ spell_check (
|
||||
// Check for end of sentence.
|
||||
regmatch.regprog = wp->w_s->b_cap_prog;
|
||||
regmatch.rm_ic = FALSE;
|
||||
if (vim_regexec(®match, ptr, 0))
|
||||
int r = vim_regexec(®match, ptr, 0);
|
||||
wp->w_s->b_cap_prog = regmatch.regprog;
|
||||
if (r) {
|
||||
*capcol = (int)(regmatch.endp[0] - ptr);
|
||||
}
|
||||
}
|
||||
|
||||
if (has_mbyte) {
|
||||
@@ -1733,7 +1736,6 @@ match_checkcompoundpattern (
|
||||
// does not have too many syllables.
|
||||
static bool can_compound(slang_T *slang, char_u *word, char_u *flags)
|
||||
{
|
||||
regmatch_T regmatch;
|
||||
char_u uflags[MAXWLEN * 2];
|
||||
int i;
|
||||
char_u *p;
|
||||
@@ -1749,9 +1751,7 @@ static bool can_compound(slang_T *slang, char_u *word, char_u *flags)
|
||||
p = uflags;
|
||||
} else
|
||||
p = flags;
|
||||
regmatch.regprog = slang->sl_compprog;
|
||||
regmatch.rm_ic = FALSE;
|
||||
if (!vim_regexec(®match, p, 0))
|
||||
if (!vim_regexec_prog(&slang->sl_compprog, false, p, 0))
|
||||
return false;
|
||||
|
||||
// Count the number of syllables. This may be slow, do it last. If there
|
||||
@@ -1850,8 +1850,6 @@ valid_word_prefix (
|
||||
{
|
||||
int prefcnt;
|
||||
int pidx;
|
||||
regprog_T *rp;
|
||||
regmatch_T regmatch;
|
||||
int prefid;
|
||||
|
||||
prefid = (unsigned)flags >> 24;
|
||||
@@ -1869,12 +1867,11 @@ valid_word_prefix (
|
||||
|
||||
// Check the condition, if there is one. The condition index is
|
||||
// stored in the two bytes above the prefix ID byte.
|
||||
rp = slang->sl_prefprog[((unsigned)pidx >> 8) & 0xffff];
|
||||
if (rp != NULL) {
|
||||
regmatch.regprog = rp;
|
||||
regmatch.rm_ic = FALSE;
|
||||
if (!vim_regexec(®match, word, 0))
|
||||
regprog_T **rp = &slang->sl_prefprog[((unsigned)pidx >> 8) & 0xffff];
|
||||
if (*rp != NULL) {
|
||||
if (!vim_regexec_prog(rp, false, word, 0)) {
|
||||
continue;
|
||||
}
|
||||
} else if (cond_req)
|
||||
continue;
|
||||
|
||||
@@ -5670,7 +5667,6 @@ store_aff_word (
|
||||
hashitem_T *hi;
|
||||
affheader_T *ah;
|
||||
affentry_T *ae;
|
||||
regmatch_T regmatch;
|
||||
char_u newword[MAXWLEN];
|
||||
int retval = OK;
|
||||
int i, j;
|
||||
@@ -5707,15 +5703,13 @@ store_aff_word (
|
||||
// When a previously added affix had CIRCUMFIX this one
|
||||
// must have it too, if it had not then this one must not
|
||||
// have one either.
|
||||
regmatch.regprog = ae->ae_prog;
|
||||
regmatch.rm_ic = FALSE;
|
||||
if ((xht != NULL || !affile->af_pfxpostpone
|
||||
|| ae->ae_chop != NULL
|
||||
|| ae->ae_flags != NULL)
|
||||
&& (ae->ae_chop == NULL
|
||||
|| STRLEN(ae->ae_chop) < wordlen)
|
||||
&& (ae->ae_prog == NULL
|
||||
|| vim_regexec(®match, word, (colnr_T)0))
|
||||
|| vim_regexec_prog(&ae->ae_prog, false, word, (colnr_T)0))
|
||||
&& (((condit & CONDIT_CFIX) == 0)
|
||||
== ((condit & CONDIT_AFF) == 0
|
||||
|| ae->ae_flags == NULL
|
||||
@@ -8636,6 +8630,7 @@ static bool check_need_cap(linenr_T lnum, colnr_T col)
|
||||
break;
|
||||
}
|
||||
}
|
||||
curwin->w_s->b_cap_prog = regmatch.regprog;
|
||||
}
|
||||
|
||||
xfree(line_copy);
|
||||
|
Reference in New Issue
Block a user