mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.1483: searchpair() might return an invalid value on timeout
Problem: Searchpair() might return an invalid value on timeout.
Solution: When the second search times out, do not accept a match from the
first search. (Daniel Hahler, closes vim/vim#2552)
9d32276b52
This commit is contained in:
parent
34b99bc06b
commit
d929a41f5f
@ -775,12 +775,17 @@ int searchit(
|
||||
}
|
||||
}
|
||||
if (ptr[matchcol] == NUL
|
||||
|| (nmatched = vim_regexec_multi(®match,
|
||||
win, buf, lnum + matchpos.lnum,
|
||||
matchcol,
|
||||
tm
|
||||
)) == 0)
|
||||
break;
|
||||
|| (nmatched = vim_regexec_multi(
|
||||
®match, win, buf, lnum + matchpos.lnum, matchcol,
|
||||
tm)) == 0) {
|
||||
// If the search timed out, we did find a match
|
||||
// but it might be the wrong one, so that's not
|
||||
// OK.
|
||||
if (tm != NULL && profile_passed_limit(*tm)) {
|
||||
match_ok = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Need to get the line pointer again, a
|
||||
* multi-line search may have made it invalid. */
|
||||
|
Loading…
Reference in New Issue
Block a user