diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-04-17 13:08:53 +0200 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2023-04-19 16:34:15 +0200 |
commit | aee6f08ce12a62e9104892702a658a8d3daee4df (patch) | |
tree | 3a9e9b6f0e546fe3f685a1de2a074118ed19c860 /src/nvim/regexp_nfa.c | |
parent | 7bf1a917b78ebc622b6691af9196b95b4a9d3142 (diff) | |
download | rneovim-aee6f08ce12a62e9104892702a658a8d3daee4df.tar.gz rneovim-aee6f08ce12a62e9104892702a658a8d3daee4df.tar.bz2 rneovim-aee6f08ce12a62e9104892702a658a8d3daee4df.zip |
fix(runtime): do not allow breakcheck inside runtime path calculation
problem: breakcheck might run arbitrary lua code, which might require
modules and thus invoke runtime path calculation recursively.
solution: Block the use of breakcheck when expanding glob patterns
inside 'runtimepath'
fixes #23012
Diffstat (limited to 'src/nvim/regexp_nfa.c')
-rw-r--r-- | src/nvim/regexp_nfa.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index 260d40a202..69d4f00ee5 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -5890,7 +5890,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm regsubs_T *r; // Some patterns may take a long time to match, especially when using // recursive_regmatch(). Allow interrupting them with CTRL-C. - fast_breakcheck(); + reg_breakcheck(); if (got_int) { return false; } @@ -6020,7 +6020,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm for (listidx = 0; listidx < thislist->n; listidx++) { // If the list gets very long there probably is something wrong. // At least allow interrupting with CTRL-C. - fast_breakcheck(); + reg_breakcheck(); if (got_int) { break; } @@ -7168,7 +7168,7 @@ nextchar: } // Allow interrupting with CTRL-C. - line_breakcheck(); + reg_breakcheck(); if (got_int) { break; } @@ -7591,6 +7591,7 @@ static int nfa_regexec_nl(regmatch_T *rmp, uint8_t *line, colnr_T col, bool line rex.reg_win = NULL; rex.reg_ic = rmp->rm_ic; rex.reg_icombine = false; + rex.reg_nobreak = rmp->regprog->re_flags & RE_NOBREAK; rex.reg_maxcol = 0; return (int)nfa_regexec_both(line, col, NULL, NULL); } |