diff options
| author | Xin LI <delphij@FreeBSD.org> | 2025-11-10 00:42:45 -0800 |
|---|---|---|
| committer | Xin LI <delphij@FreeBSD.org> | 2025-11-10 00:42:45 -0800 |
| commit | a1320769a9f7fd8fe7e039f915f502bb43376909 (patch) | |
| tree | bc426a108de21d685fea478d19e352ba117363de /pattern.c | |
| parent | 9006df9a94bf66485f7d23eec79eb6a344136401 (diff) | |
Vendor import of less v685.vendor/less/v685vendor/less
Diffstat (limited to 'pattern.c')
| -rw-r--r-- | pattern.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pattern.c b/pattern.c index f2ec7cbcb6c8..0c72b98d2cd1 100644 --- a/pattern.c +++ b/pattern.c @@ -469,7 +469,12 @@ public lbool match_pattern(PATTERN_TYPE pattern, constant char *tpattern, consta lbool matched = match_pattern1(pattern, tpattern, line, line_len, line_off, sp, ep, nsp, notbol, search_type); if (!matched || subsearch_ok(sp, ep, search_type)) return matched; - mlen = ep[0] - line; + /* We have a match, but it does not satisfy all SUBSEARCH conditions. + * Continue searching after this match. */ + mlen = ptr_diff(ep[0], line); + if (mlen == 0) + /* If the match is empty, we can't progress. */ + return FALSE; line += mlen; line_len -= mlen; notbol = 1; |
