diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-04-19 17:07:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-19 17:07:33 +0200 |
commit | 3940c435e4058f75b8ecbfc9f9c3b2a2c4b64f37 (patch) | |
tree | 3c23ed475376a20f2334f5131ebc5b39f6afe343 /src/nvim/regexp.c | |
parent | ea52961c54797fc27e305eb4bb11a5d2c4cdda58 (diff) | |
parent | aee6f08ce12a62e9104892702a658a8d3daee4df (diff) | |
download | rneovim-3940c435e4058f75b8ecbfc9f9c3b2a2c4b64f37.tar.gz rneovim-3940c435e4058f75b8ecbfc9f9c3b2a2c4b64f37.tar.bz2 rneovim-3940c435e4058f75b8ecbfc9f9c3b2a2c4b64f37.zip |
Merge pull request #23155 from bfredl/nobreak
fix(runtime): do not allow breakcheck inside runtime path calculation
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r-- | src/nvim/regexp.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 3ed32bf8af..b5cffb17d0 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -989,6 +989,8 @@ typedef struct { // flag in the regexp. Defaults to false, always. bool reg_icombine; + bool reg_nobreak; + // Copy of "rmm_maxcol": maximum column to search for a match. Zero when // there is no maximum. colnr_T reg_maxcol; @@ -1011,6 +1013,13 @@ typedef struct { static regexec_T rex; static bool rex_in_use = false; +static void reg_breakcheck(void) +{ + if (!rex.reg_nobreak) { + fast_breakcheck(); + } +} + // Return true if character 'c' is included in 'iskeyword' option for // "reg_buf" buffer. static bool reg_iswordc(int c) @@ -1221,7 +1230,7 @@ static void reg_nextline(void) { rex.line = (uint8_t *)reg_getline(++rex.lnum); rex.input = rex.line; - fast_breakcheck(); + reg_breakcheck(); } // Check whether a backreference matches. @@ -2265,6 +2274,7 @@ static void init_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_ rex.reg_line_lbr = false; rex.reg_ic = rmp->rmm_ic; rex.reg_icombine = false; + rex.reg_nobreak = rmp->regprog->re_flags & RE_NOBREAK; rex.reg_maxcol = rmp->rmm_maxcol; } |