This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/9793] iconv() incorrectly handles E2BIG condition by partially processing output char
- From: "keithw at mit dot edu" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 27 Jan 2009 19:08:47 -0000
- Subject: [Bug libc/9793] iconv() incorrectly handles E2BIG condition by partially processing output char
- References: <20090127190216.9793.keithw@mit.edu>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From keithw at mit dot edu 2009-01-27 19:08 -------
Created an attachment (id=3691)
--> (http://sourceware.org/bugzilla/attachment.cgi?id=3691&action=view)
Test case for iconv() E2BIG partial transliteration
Here is a test case that demonstrates the E2BIG case. Converting the UTF-8
"registered trademark" symbol into ASCII//TRANSLIT, iconv() wants to write out
"(R)". But here it only has two bytes. The POSIX and GNU libiconv() behavior is
to advance inbuf by zero, advance outbuf by zero, and return E2BIG -- stopping
the conversion prior to the overflow.
But the glibc iconv() behavior is to advance inbuf by 0, advance outbuf by 2,
and write "(R", and return E2BIG. This is an incomplete conversion that the
application has no way of correcting, because of the inconsistent state of the
pointers. If the application restarts iconv() from the current location of
inbuf and outbuf with a larger output buffer, it will get garbage -- like
"(R(R)", since the registered trademark symbol will be converted again,
appended to the original incomplete transliteration.
--
http://sourceware.org/bugzilla/show_bug.cgi?id=9793
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.