diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-11-29 01:51:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-29 01:51:26 +0100 |
commit | 5a752c97d5294f4a69613db71adf9beb6a8f8790 (patch) | |
tree | 7483b993657af7aa07dd2cb3a3390bc0dbf40899 /src/nvim/syntax.c | |
parent | 98eaf60a98d0dfec9b1addb2c4efb3655c095044 (diff) | |
download | rneovim-5a752c97d5294f4a69613db71adf9beb6a8f8790.tar.gz rneovim-5a752c97d5294f4a69613db71adf9beb6a8f8790.tar.bz2 rneovim-5a752c97d5294f4a69613db71adf9beb6a8f8790.zip |
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.
https://github.com/vim/vim/commit/bcf9442307075bac40d44328c8bf7ea21857b138
closes #8788
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r-- | src/nvim/syntax.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 2cade9f281..973d09d065 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -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); |