summaryrefslogtreecommitdiff
path: root/pp_pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'pp_pack.c')
-rw-r--r--pp_pack.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/pp_pack.c b/pp_pack.c
index 5f1a599eb4..726f7438a3 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -3149,6 +3149,21 @@ PP(pp_pack)
packlist(cat, pat, patend, MARK, SP + 1);
+ if (SvUTF8(cat)) {
+ STRLEN result_len;
+ const char * result = SvPV_nomg(cat, result_len);
+ const U8 * error_pos;
+
+ if (! is_utf8_string_loc((U8 *) result, result_len, &error_pos)) {
+ _force_out_malformed_utf8_message(error_pos,
+ (U8 *) result + result_len,
+ 0, /* no flags */
+ 1 /* Die */
+ );
+ NOT_REACHED; /* NOTREACHED */
+ }
+ }
+
SvSETMAGIC(cat);
SP = ORIGMARK;
PUSHs(cat);