Change 13722 by jhi@alpha on 2001/12/16 16:12:57

        Disallow also Unicode ranges 0xFDD0..0xFDEF and
        0xFFFE..0xFFFF.  Ranges 0x...FFFE..0x...FFFF in general,
        and characters beyond 0x10FFF should be disallowed, too,
        but some tests would need changing, but more importantly some
        APIs would need remodeling since one can easily generate such
        characters either by bitwise complements, tr complements, or
        v-strings.

Affected files ...

.... //depot/perl/pod/perldiag.pod#249 edit
.... //depot/perl/utf8.c#131 edit

Differences ...

==== //depot/perl/pod/perldiag.pod#249 (text) ====
Index: perl/pod/perldiag.pod
--- perl/pod/perldiag.pod.~1~   Sun Dec 16 09:30:05 2001
+++ perl/pod/perldiag.pod       Sun Dec 16 09:30:05 2001
@@ -3603,6 +3603,10 @@
 (F) The unexec() routine failed for some reason.  See your local FSF
 representative, who probably put it there in the first place.
 
+=item Unicode character %s is illegal
+
+Certain Unicode characters have been designated off-limits by the
+Unicode standard and should not be generated.
 
 =item Unknown BYTEORDER
 

==== //depot/perl/utf8.c#131 (text) ====
Index: perl/utf8.c
--- perl/utf8.c.~1~     Sun Dec 16 09:30:05 2001
+++ perl/utf8.c Sun Dec 16 09:30:05 2001
@@ -46,12 +46,15 @@
 U8 *
 Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv)
 {
+    if (UNICODE_IS_SURROGATE(uv))
+        Perl_croak(aTHX_ "UTF-16 surrogate 0x%04"UVxf, uv);
+    else if ((uv >= 0xFDD0 && uv <= 0xFDEF) ||
+            (uv == 0xFFFE || uv == 0xFFFF))
+        Perl_croak(aTHX_ "Unicode character 0x%04"UVxf" is illegal", uv);
     if (UNI_IS_INVARIANT(uv)) {
        *d++ = UTF_TO_NATIVE(uv);
        return d;
     }
-    if (UNICODE_IS_SURROGATE(uv))
-        Perl_croak(aTHX_ "UTF-16 surrogate 0x%04"UVxf, uv);
 #if defined(EBCDIC)
     else {
        STRLEN len  = UNISKIP(uv);
End of Patch.

Reply via email to