summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cpan/Encode/Unicode/Unicode.xs
diff options
context:
space:
mode:
authorafresh1 <afresh1@openbsd.org>2014-03-24 15:05:12 +0000
committerafresh1 <afresh1@openbsd.org>2014-03-24 15:05:12 +0000
commite9ce384231aabe5c5a622aa68cef46f2c5bfdb4a (patch)
tree5029388537325eaad6674da4dab6714cda1644e5 /gnu/usr.bin/perl/cpan/Encode/Unicode/Unicode.xs
parentImport perl-5.18.2 (diff)
downloadwireguard-openbsd-e9ce384231aabe5c5a622aa68cef46f2c5bfdb4a.tar.xz
wireguard-openbsd-e9ce384231aabe5c5a622aa68cef46f2c5bfdb4a.zip
Merge perl-5.18.2 plus local patches, remove old files
OK espie@ sthen@ deraadt@
Diffstat (limited to 'gnu/usr.bin/perl/cpan/Encode/Unicode/Unicode.xs')
-rw-r--r--gnu/usr.bin/perl/cpan/Encode/Unicode/Unicode.xs30
1 files changed, 19 insertions, 11 deletions
diff --git a/gnu/usr.bin/perl/cpan/Encode/Unicode/Unicode.xs b/gnu/usr.bin/perl/cpan/Encode/Unicode/Unicode.xs
index 039f1559a3d..026f8fb1cae 100644
--- a/gnu/usr.bin/perl/cpan/Encode/Unicode/Unicode.xs
+++ b/gnu/usr.bin/perl/cpan/Encode/Unicode/Unicode.xs
@@ -1,5 +1,5 @@
/*
- $Id: Unicode.xs,v 2.8 2011/08/09 07:49:44 dankogai Exp dankogai $
+ $Id: Unicode.xs,v 2.9 2012/08/05 23:08:49 dankogai Exp $
*/
#define PERL_NO_GET_CONTEXT
@@ -199,10 +199,6 @@ CODE:
*hv_fetch((HV *)SvRV(obj),"Name",4,0),
ord);
}
- if (s+size <= e) {
- /* skip the next one as well */
- enc_unpack(aTHX_ &s,e,size,endian);
- }
ord = FBCHAR;
}
else {
@@ -217,12 +213,23 @@ CODE:
ord = FBCHAR;
}
}
- else {
- if (s+size > e) {
- /* Partial character */
- s -= size; /* back up to 1st half */
- break; /* And exit loop */
+ else if (s+size > e) {
+ if (check) {
+ if (check & ENCODE_STOP_AT_PARTIAL) {
+ s -= size;
+ break;
+ }
+ else {
+ croak("%"SVf":Malformed HI surrogate %"UVxf,
+ *hv_fetch((HV *)SvRV(obj),"Name",4,0),
+ ord);
+ }
}
+ else {
+ ord = FBCHAR;
+ }
+ }
+ else {
lo = enc_unpack(aTHX_ &s,e,size,endian);
if (!isLoSurrogate(lo)) {
if (check) {
@@ -231,6 +238,7 @@ CODE:
ord);
}
else {
+ s -= size;
ord = FBCHAR;
}
}
@@ -348,7 +356,7 @@ CODE:
if (ucs2 == -1) {
ucs2 = SvTRUE(attr("ucs2", 4));
}
- if (ucs2) {
+ if (ucs2 || ord > 0x10FFFF) {
if (check) {
croak("%"SVf":code point \"\\x{%"UVxf"}\" too high",
*hv_fetch((HV *)SvRV(obj),"Name",4,0),ord);