regexec.c: Use safer utf8_hop
authorKarl Williamson <khw@cpan.org>
Mon, 18 Mar 2019 17:09:22 +0000 (11:09 -0600)
committerKarl Williamson <khw@cpan.org>
Tue, 19 Mar 2019 16:24:29 +0000 (10:24 -0600)
regexec.c

index cd0a94f..5a6c657 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -3305,7 +3305,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const rx, char *stringarg, char *strend,
             RXp_MATCH_UTF8_set(prog, utf8_target);
             prog->offs[0].start = s - strbeg;
             prog->offs[0].end = utf8_target
-                ? (char*)utf8_hop((U8*)s, prog->minlenret) - strbeg
+                ? (char*)utf8_hop_forward((U8*)s, prog->minlenret, (U8 *) strend) - strbeg
                 : s - strbeg + prog->minlenret;
             if ( !(flags & REXEC_NOT_FIRST) )
                 S_reg_set_capture_string(aTHX_ rx,