summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-10-18 21:30:41 +0100
committerNicholas Clark <nick@ccl4.org>2009-10-18 22:10:36 +0100
commite0ea5e2d50a479e160d39f481e02abd7c0c9cf91 (patch)
treefb57ba0ad27123ca5845fb62789f53338a1dbeb7 /ext
parent30685b5659009a95642202219acc6ded18f74dbc (diff)
downloadperl-e0ea5e2d50a479e160d39f481e02abd7c0c9cf91.tar.gz
utf16_to_utf8_reversed() should croak early when passed an odd byte length.
Rather than transposing n + 1 bytes, including 1 it was not passed, before calling utf16_to_utf8() and having that croak. e 69422~
Diffstat (limited to 'ext')
-rw-r--r--ext/XS-APItest/t/utf16_to_utf8.t7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/XS-APItest/t/utf16_to_utf8.t b/ext/XS-APItest/t/utf16_to_utf8.t
index 3da3d7d12b..83add20a27 100644
--- a/ext/XS-APItest/t/utf16_to_utf8.t
+++ b/ext/XS-APItest/t/utf16_to_utf8.t
@@ -47,3 +47,10 @@ for (["\xD8\0\0\0", 'NULs'],
"Malformed surrogate $name croaks for utf16_to_utf8_reversed");
is($got, undef, 'hence eval returns undef');
}
+
+my $in = "NA";
+$got = eval {utf16_to_utf8_reversed($in, 1)};
+like($@, qr/^panic: utf16_to_utf8_reversed: odd bytelen 1 at/,
+ 'Odd byte length panics');
+is($got, undef, 'hence eval returns undef');
+is($in, "NA", 'and input unchanged');