aboutsummaryrefslogtreecommitdiffstats
path: root/support/regexec.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2021-10-23 21:53:50 +0300
committerArnold D. Robbins <arnold@skeeve.com>2021-10-23 21:53:50 +0300
commite665ebe9a6d6581e145830ae277a79e18f43ecad (patch)
treed9435716e52d7cb87445c00819b5b007c54c2c0c /support/regexec.c
parent19a4de34496c20c1c8d068837dba4e3357b75146 (diff)
parent399f6e45acbda2dc5ca5eb24d1c648800be5006a (diff)
downloadegawk-e665ebe9a6d6581e145830ae277a79e18f43ecad.tar.gz
egawk-e665ebe9a6d6581e145830ae277a79e18f43ecad.tar.bz2
egawk-e665ebe9a6d6581e145830ae277a79e18f43ecad.zip
Merge branch 'gawk-5.1-stable'
Diffstat (limited to 'support/regexec.c')
-rw-r--r--support/regexec.c7
1 files changed, 3 insertions, 4 deletions
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;