In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/1d5030e143202c1e963e1fc91eb6f3afaa2df83e?hp=5cd155b07ed261125793850e101ebe6fa438c5e3>
- Log ----------------------------------------------------------------- commit 1d5030e143202c1e963e1fc91eb6f3afaa2df83e Author: Karl Williamson <[email protected]> Date: Sat Jun 24 11:47:19 2017 -0600 PATCH: [perl #131646] Assertion fail UTF-8 error msg Instead of croaking with a proper message, creating the message creates an assertion failure. The cause was that there were two ++ operators on a string, so one should subtract 2 to get to the string start, but only 1 was being subtracted. This is a 5.26 regression, but not terribly consequential, as the program is about to die, but it is a trivial fix that allows the reason the crash is happening to be properly displayed to aid debugging, so I'm adding my vote for it for 5.26.1. ----------------------------------------------------------------------- Summary of changes: t/lib/warnings/utf8 | 13 +++++++++++++ utf8.c | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/t/lib/warnings/utf8 b/t/lib/warnings/utf8 index a4dfb12698..a26bbedc24 100644 --- a/t/lib/warnings/utf8 +++ b/t/lib/warnings/utf8 @@ -749,3 +749,16 @@ BEGIN{ {};$^H=eval'2**400'}Â EXPECT Malformed UTF-8 character: \xc2\x0a (unexpected non-continuation byte 0x0a, immediately after start byte 0xc2; need 2 bytes, got 1) at - line 11. +######## +# NAME [perl #131646] +BEGIN{ + if (ord('A') == 193) { + print "SKIPPED\n# ebcdic platforms generates different Malformed UTF-8 warnings."; + exit 0; + } +} +no warnings; +use warnings 'utf8'; +for(uc 0..t){0~~pack"UXp>",exp} +EXPECT +Malformed UTF-8 character: \xc2\x00 (unexpected non-continuation byte 0x00, immediately after start byte 0xc2; need 2 bytes, got 1) in smart match at - line 9. diff --git a/utf8.c b/utf8.c index 68ac640e65..2ee701a3ec 100644 --- a/utf8.c +++ b/utf8.c @@ -1875,7 +1875,7 @@ Perl_bytes_cmp_utf8(pTHX_ const U8 *b, STRLEN blen, const U8 *u, STRLEN ulen) /* diag_listed_as: Malformed UTF-8 character%s */ Perl_ck_warner_d(aTHX_ packWARN(WARN_UTF8), "%s %s%s", - unexpected_non_continuation_text(u - 1, 2, 1, 2), + unexpected_non_continuation_text(u - 2, 2, 1, 2), PL_op ? " in " : "", PL_op ? OP_DESC(PL_op) : ""); return -2; -- Perl5 Master Repository
