fix iconv conversion to UTF-32 with implicit (big) endianness
authorWill Dietz <w@wdtz.org>
Thu, 3 May 2018 18:44:53 +0000 (13:44 -0500)
committerRich Felker <dalias@aerifal.cx>
Wed, 9 May 2018 20:27:46 +0000 (16:27 -0400)
maintainer's notes:

commit 95c6044e2ae85846330814c4ac5ebf4102dbe02c split UTF-32 and
UTF-32BE but neglected to add a case for the former as a destination
encoding, resulting in it wrongly being handled by the default case.
the intent was that the value of the macro be chosen to encode "big
endian" in the low bits, so that no code would be needed, but this was
botched; instead, handle it the way UCS2 is handled.

src/locale/iconv.c

index 3c1f4dd26f40b23979b11a7fcb5c8713ed450c6b..3a34395cfad8b091a5bec186f3f22398dedbc8de 100644 (file)
@@ -646,6 +646,8 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri
                        *out += 4;
                        *outb -= 4;
                        break;
+               case UTF_32:
+                       totype = UTF_32BE;
                case UTF_32BE:
                case UTF_32LE:
                        if (*outb < 4) goto toobig;