mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-11 00:48:35 +03:00
fix erroneous utf-16 encoding with surrogates in iconv
apparently this was never tested before.
This commit is contained in:
parent
deb90c79e5
commit
a2f149b5d1
@ -336,6 +336,7 @@ size_t iconv(iconv_t cd0, char **in, size_t *inb, char **out, size_t *outb)
|
|||||||
}
|
}
|
||||||
if (type-UCS2BE < 2U) goto ilseq;
|
if (type-UCS2BE < 2U) goto ilseq;
|
||||||
if (*outb < 4) goto toobig;
|
if (*outb < 4) goto toobig;
|
||||||
|
c -= 0x10000;
|
||||||
put_16((void *)*out, (c>>10)|0xd800, totype);
|
put_16((void *)*out, (c>>10)|0xd800, totype);
|
||||||
put_16((void *)(*out + 2), (c&0x3ff)|0xdc00, totype);
|
put_16((void *)(*out + 2), (c&0x3ff)|0xdc00, totype);
|
||||||
*out += 4;
|
*out += 4;
|
||||||
|
Loading…
Reference in New Issue
Block a user