]> sourceware.org Git - newlib-cygwin.git/commitdiff
Fix UTF-16 surrogate handling in wctomb and friends.
authorCorinna Vinschen <corinna@vinschen.de>
Wed, 1 Apr 2015 13:31:18 +0000 (15:31 +0200)
committerCorinna Vinschen <corinna@vinschen.de>
Thu, 23 Apr 2015 19:57:09 +0000 (21:57 +0200)
* libc/stdlib/wctomb_r.c (__utf8_wctomb): Fix check for handling a
lone high surrogate.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
newlib/ChangeLog
newlib/libc/stdlib/wctomb_r.c
winsup/cygwin/release/1.7.36

index e615421d18a5ee90cdf7af452b8100808230a8e7..a5a31c7b07f4f29370ec4f8f70ce3224031fad0b 100644 (file)
@@ -1,3 +1,8 @@
+2015-04-01  Corinna Vinschen  <vinschen@redhat.com>
+
+       * libc/stdlib/wctomb_r.c (__utf8_wctomb): Fix check for handling a
+       lone high surrogate.
+
 2015-03-31  Corinna Vinschen  <vinschen@redhat.com>
 
        * libc/time/lcltime_r.c (localtime_r): Call _tzset_unlocked inside
index 13e1e4c36fb50a823cea4be6e4a595f1bc6f3d91..c93962fa439d9a4a8c63b19eba833161915b3f53 100644 (file)
@@ -74,7 +74,7 @@ _DEFUN (__utf8_wctomb, (r, s, wchar, charset, state),
     return 0; /* UTF-8 encoding is not state-dependent */
 
   if (sizeof (wchar_t) == 2 && state->__count == -4
-      && (wchar < 0xdc00 || wchar >= 0xdfff))
+      && (wchar < 0xdc00 || wchar > 0xdfff))
     {
       /* There's a leftover lone high surrogate.  Write out the CESU-8 value
         of the surrogate and proceed to convert the given character.  Note
index 21175c9ac1e8527edddef2e2e7f2ba44f25ba0e7..0515ef96e9953904e2d061bab4cfae0da75ae5bf 100644 (file)
@@ -35,3 +35,6 @@ Bug Fixes
 
 - Avoid potential crash at startup or in getgroups(2).
   Addresses: https://cygwin.com/ml/cygwin/2015-04/msg00010.html
+
+- Fix UTF-16 surrogate handling in wctomb and friends.
+  Addresses: https://cygwin.com/ml/cygwin/2015-03/msg00452.html
This page took 0.053779 seconds and 5 git commands to generate.