diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-07-25 01:34:07 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-08-02 12:00:01 -0400 |
commit | ca698250fc0d7a12cc77bca73db513b4fe63a39d (patch) | |
tree | 78993b8214812c673d54591e01c0911002bf478b /src/nvim/regexp.c | |
parent | 1ab1de78450ba656e4127a22fd7cf58f86754518 (diff) | |
download | rneovim-ca698250fc0d7a12cc77bca73db513b4fe63a39d.tar.gz rneovim-ca698250fc0d7a12cc77bca73db513b4fe63a39d.tar.bz2 rneovim-ca698250fc0d7a12cc77bca73db513b4fe63a39d.zip |
vim-patch:8.1.0194: possibly use of NULL pointer
Problem: Possibly use of NULL pointer. (Coverity)
Solution: Reset the re_in_use flag earlier.
https://github.com/vim/vim/commit/414998023fbff15cce20ef01a54d0366370ad8b6
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r-- | src/nvim/regexp.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 5fdd18733e..2aa6096c0f 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -7279,6 +7279,7 @@ static bool vim_regexec_string(regmatch_T *rmp, char_u *line, colnr_T col, rex.reg_endpos = NULL; int result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl); + rmp->regprog->re_in_use = false; // NFA engine aborted because it's very slow, use backtracking engine instead. if (rmp->regprog->re_engine == AUTOMATIC_ENGINE @@ -7292,7 +7293,9 @@ static bool vim_regexec_string(regmatch_T *rmp, char_u *line, colnr_T col, report_re_switch(pat); rmp->regprog = vim_regcomp(pat, re_flags); if (rmp->regprog != NULL) { + rmp->regprog->re_in_use = true; result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl); + rmp->regprog->re_in_use = false; } xfree(pat); @@ -7303,7 +7306,6 @@ static bool vim_regexec_string(regmatch_T *rmp, char_u *line, colnr_T col, if (rex_in_use) { rex = rex_save; } - rmp->regprog->re_in_use = false; return result > 0; } @@ -7369,6 +7371,7 @@ long vim_regexec_multi( int result = rmp->regprog->engine->regexec_multi(rmp, win, buf, lnum, col, tm, timed_out); + rmp->regprog->re_in_use = false; // NFA engine aborted because it's very slow, use backtracking engine instead. if (rmp->regprog->re_engine == AUTOMATIC_ENGINE @@ -7387,8 +7390,10 @@ long vim_regexec_multi( reg_do_extmatch = 0; if (rmp->regprog != NULL) { + rmp->regprog->re_in_use = true; result = rmp->regprog->engine->regexec_multi(rmp, win, buf, lnum, col, tm, timed_out); + rmp->regprog->re_in_use = false; } xfree(pat); @@ -7399,7 +7404,6 @@ long vim_regexec_multi( if (rex_in_use) { rex = rex_save; } - rmp->regprog->re_in_use = false; return result <= 0 ? 0 : result; } |