mirror of
https://github.com/neovim/neovim.git
synced 2025-11-23 18:46:38 +00:00
vim-patch:8.1.0098: segfault when pattern with \z() is very slow (#9283)
Problem: Segfault when pattern with \z() is very slow.
Solution: Check for NULL regprog. Add "nfa_fail" to test_override() to be
able to test this. Fix that 'searchhl' resets called_emsg.
bcf9442307
closes #8788
This commit is contained in:
@@ -2894,6 +2894,13 @@ static int syn_regexec(regmmatch_T *rmp, linenr_T lnum, colnr_T col, syn_time_T
|
||||
pt = profile_start();
|
||||
}
|
||||
|
||||
if (rmp->regprog == NULL) {
|
||||
// This can happen if a previous call to vim_regexec_multi() tried to
|
||||
// use the NFA engine, which resulted in NFA_TOO_EXPENSIVE, and
|
||||
// compiling the pattern with the other engine fails.
|
||||
return false;
|
||||
}
|
||||
|
||||
rmp->rmm_maxcol = syn_buf->b_p_smc;
|
||||
r = vim_regexec_multi(rmp, syn_win, syn_buf, lnum, col, NULL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user