Skip to content

Commit 28aeb4e

Browse files
committed
pp_unpack: Use utf8_to_uv over utf8n_to_uvchr
1 parent 6301a3e commit 28aeb4e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pp_pack.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,10 +1256,11 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c
12561256
if (utf8) {
12571257
while (len-- > 0 && s < strend) {
12581258
STRLEN retlen;
1259-
const UV val = utf8n_to_uvchr((U8 *) s, strend-s, &retlen,
1260-
ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY);
1261-
if (retlen == (STRLEN) -1)
1259+
UV val;
1260+
if (! utf8_to_uv((const U8 *) s, (const U8 *) strend,
1261+
&val, &retlen)) {
12621262
Perl_croak(aTHX_ "Malformed UTF-8 string in unpack");
1263+
}
12631264
s += retlen;
12641265
if (!checksum)
12651266
mPUSHu(val);

0 commit comments

Comments
 (0)