projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a2f149b
)
fix iconv dest utf-16: unavailable chars must be replaced; EILSEQ is wrong
author
Rich Felker
<dalias@aerifal.cx>
Tue, 19 Jun 2012 00:43:21 +0000
(20:43 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Tue, 19 Jun 2012 00:43:21 +0000
(20:43 -0400)
src/locale/iconv.c
patch
|
blob
|
history
diff --git
a/src/locale/iconv.c
b/src/locale/iconv.c
index c48e45aa325a7e46c8a600f3d0ac580edda3e436..78c215e16a2783d4b59c4c83a88c80cf9a78656c 100644
(file)
--- a/
src/locale/iconv.c
+++ b/
src/locale/iconv.c
@@
-327,14
+327,14
@@
size_t iconv(iconv_t cd0, char **in, size_t *inb, char **out, size_t *outb)
case UCS2LE:
case UTF_16BE:
case UTF_16LE:
- if (c < 0x10000) {
+ if (c < 0x10000 || type-UCS2BE < 2U) {
+ if (c >= 0x10000) c = 0xFFFD;
if (*outb < 2) goto toobig;
put_16((void *)*out, c, totype);
*out += 2;
*outb -= 2;
break;
}
- if (type-UCS2BE < 2U) goto ilseq;
if (*outb < 4) goto toobig;
c -= 0x10000;
put_16((void *)*out, (c>>10)|0xd800, totype);