diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2015-04-01 15:31:18 +0200 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2015-04-23 21:57:09 +0200 |
commit | 9b42474f293d068dcaa65f2f20ca268c51c960ec (patch) | |
tree | 91b253b909bab4b1b3259f926bf6c5fe9a0c5672 /newlib | |
parent | 71a897e40d4a9f0b3a6caf6bae974c00aae2cbe8 (diff) | |
download | newlib-9b42474f293d068dcaa65f2f20ca268c51c960ec.zip newlib-9b42474f293d068dcaa65f2f20ca268c51c960ec.tar.gz newlib-9b42474f293d068dcaa65f2f20ca268c51c960ec.tar.bz2 |
Fix UTF-16 surrogate handling in wctomb and friends.
* libc/stdlib/wctomb_r.c (__utf8_wctomb): Fix check for handling a
lone high surrogate.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/ChangeLog | 5 | ||||
-rw-r--r-- | newlib/libc/stdlib/wctomb_r.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index e615421..a5a31c7 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -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 diff --git a/newlib/libc/stdlib/wctomb_r.c b/newlib/libc/stdlib/wctomb_r.c index 13e1e4c..c93962f 100644 --- a/newlib/libc/stdlib/wctomb_r.c +++ b/newlib/libc/stdlib/wctomb_r.c @@ -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 |