This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_pack.c: Use safe UTF8SKIP
authorKarl Williamson <khw@cpan.org>
Tue, 19 Mar 2019 01:27:57 +0000 (19:27 -0600)
committerKarl Williamson <khw@cpan.org>
Tue, 19 Mar 2019 16:24:28 +0000 (10:24 -0600)
pp_pack.c

index 726f743..33cb086 100644 (file)
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -290,7 +290,7 @@ S_utf8_to_bytes(pTHX_ const char **s, const char *end, const char *buf, SSize_t
        if (from >= end) return FALSE;
        val = utf8n_to_uvchr((U8 *) from, end-from, &retlen, flags);
        if (retlen == (STRLEN) -1) {
-           from += UTF8SKIP(from);
+           from += UTF8_SAFE_SKIP(from, end);
            bad |= 1;
        } else from += retlen;
        if (val >= 0x100) {