diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-06-23 14:21:42 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-06-23 14:21:42 +0200 |
commit | bcf9442307075bac40d44328c8bf7ea21857b138 (patch) | |
tree | 6890b363128e8cbffe09b274ecd1b1665393fac1 /src/syntax.c | |
parent | 5efa0102de6ed6049fb19e1e83787e5b3b24b6a2 (diff) | |
download | vim-git-bcf9442307075bac40d44328c8bf7ea21857b138.tar.gz |
patch 8.1.0098: segfault when pattern with \z() is very slowv8.1.0098
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.
Diffstat (limited to 'src/syntax.c')
-rw-r--r-- | src/syntax.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/syntax.c b/src/syntax.c index 5feaac6f5..7db69183e 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -3327,6 +3327,12 @@ syn_regexec( profile_start(&pt); #endif + 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, #ifdef FEAT_RELTIME |