From 399f6e45acbda2dc5ca5eb24d1c648800be5006a Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sat, 23 Oct 2021 21:53:08 +0300 Subject: Update support files. --- support/regexec.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'support/regexec.c') diff --git a/support/regexec.c b/support/regexec.c index 83e9aaf8..6aeba3c0 100644 --- a/support/regexec.c +++ b/support/regexec.c @@ -758,10 +758,9 @@ re_search_internal (const regex_t *preg, const char *string, Idx length, offset = match_first - mctx.input.raw_mbs_idx; } - /* If MATCH_FIRST is out of the buffer, leave it as '\0'. - Note that MATCH_FIRST must not be smaller than 0. */ - ch = (match_first >= length - ? 0 : re_string_byte_at (&mctx.input, offset)); + /* Use buffer byte if OFFSET is in buffer, otherwise '\0'. */ + ch = (offset < mctx.input.valid_len + ? re_string_byte_at (&mctx.input, offset) : 0); if (fastmap[ch]) break; match_first += incr; -- cgit v1.2.3