This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/6050] iconv(1) buffers all of stdin in memory
- From: "bugdal at aerifal dot cx" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Sat, 10 Aug 2013 16:01:22 +0000
- Subject: [Bug libc/6050] iconv(1) buffers all of stdin in memory
- Auto-submitted: auto-generated
- References: <bug-6050-131 at http dot sourceware dot org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=6050
Rich Felker <bugdal at aerifal dot cx> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bugdal at aerifal dot cx
--- Comment #1 from Rich Felker <bugdal at aerifal dot cx> ---
Ping. This bug still exists. I traced it to a comment in the source:
/* we have a problem with reading from a desriptor since we must not
provide the iconv() function an incomplete character or shift
sequence at the end of the buffer. Since we have to deal with
arbitrary encodings we must read the whole text in a buffer and
process it in one step. */
See
http://sourceware.org/git/?p=glibc.git;a=blob;f=iconv/iconv_prog.c;h=1a1d0d0cf45c0d747a8090bc234addd9e49f1ba7;hb=HEAD#l561
The claims made in the comment are simply erroneous. Per POSIX, the iconv
function returns (size_t)-1 with errno set to EINVAL to indicate "Input
conversion stopped due to an incomplete character or shift sequence at the end
of the input buffer." This is a different condition from EILSEQ, and thus the
caller can detect and recover from it simply by moving the remaining bytes of
the input buffer to the beginning, re-filling the buffer, and calling iconv
again.
If glibc's iconv function does not support this behavior correctly, that's a
library-level bug which should be filed separately and fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.