|
|
f6ea51 |
From 05b9033b464ce8dd2c9b33238f9aa14755d7a91a Mon Sep 17 00:00:00 2001
|
|
|
f6ea51 |
From: Karl Williamson <khw@cpan.org>
|
|
|
f6ea51 |
Date: Sat, 17 Jun 2017 17:56:10 -0600
|
|
|
f6ea51 |
Subject: [PATCH] utf8n_to_uvchr(): Don't display too many bytes in msg
|
|
|
f6ea51 |
MIME-Version: 1.0
|
|
|
f6ea51 |
Content-Type: text/plain; charset=UTF-8
|
|
|
f6ea51 |
Content-Transfer-Encoding: 8bit
|
|
|
f6ea51 |
|
|
|
f6ea51 |
When raising a message about malformed UTF-8, we shouldn't display bytes
|
|
|
f6ea51 |
from the next character, unless those bytes were expected to have been
|
|
|
f6ea51 |
part of the current one. Tests for this will be added in future commits
|
|
|
f6ea51 |
in ext/XS-APItest/t/utf8_warn_base.pl
|
|
|
f6ea51 |
|
|
|
f6ea51 |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
f6ea51 |
---
|
|
|
f6ea51 |
utf8.c | 4 ++--
|
|
|
f6ea51 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
f6ea51 |
|
|
|
f6ea51 |
diff --git a/utf8.c b/utf8.c
|
|
|
f6ea51 |
index ee5405f..e55a6f1 100644
|
|
|
f6ea51 |
--- a/utf8.c
|
|
|
f6ea51 |
+++ b/utf8.c
|
|
|
f6ea51 |
@@ -1428,7 +1428,7 @@ Perl_utf8n_to_uvchr_error(pTHX_ const U8 *s,
|
|
|
f6ea51 |
if (pack_warn) {
|
|
|
f6ea51 |
message = Perl_form(aTHX_ "%s: %s (overflows)",
|
|
|
f6ea51 |
malformed_text,
|
|
|
f6ea51 |
- _byte_dump_string(s0, send - s0, 0));
|
|
|
f6ea51 |
+ _byte_dump_string(s0, curlen, 0));
|
|
|
f6ea51 |
}
|
|
|
f6ea51 |
}
|
|
|
f6ea51 |
}
|
|
|
f6ea51 |
@@ -1554,7 +1554,7 @@ Perl_utf8n_to_uvchr_error(pTHX_ const U8 *s,
|
|
|
f6ea51 |
"%s: %s (overlong; instead use %s to represent"
|
|
|
f6ea51 |
" U+%0*" UVXf ")",
|
|
|
f6ea51 |
malformed_text,
|
|
|
f6ea51 |
- _byte_dump_string(s0, send - s0, 0),
|
|
|
f6ea51 |
+ _byte_dump_string(s0, curlen, 0),
|
|
|
f6ea51 |
_byte_dump_string(tmpbuf, e - tmpbuf, 0),
|
|
|
f6ea51 |
((uv < 256) ? 2 : 4), /* Field width of 2 for
|
|
|
f6ea51 |
small code points */
|
|
|
f6ea51 |
--
|
|
|
f6ea51 |
2.9.4
|
|
|
f6ea51 |
|