Bug 4936 - iconv(cd, 0, 0, 0, 0); doesn't behave like documented (glibc 2.5 and 2.6.1 atleast)
Summary: iconv(cd, 0, 0, 0, 0); doesn't behave like documented (glibc 2.5 and 2.6.1 at...
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.4
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-17 23:16 UTC by Stian Skjelstad
Modified: 2014-07-04 16:06 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stian Skjelstad 2007-08-17 23:16:43 UTC
According to the documentation, iconv(cd) with both inputbuffer and outputbuffer
set to NULL should reset the state of `cd`. However, this does not work for
"unicode" atleast.

A unicode stream starts with a BOM character, and after a iconv(cd, 0, 0, 0, 0),
I just get an error if I feed it with a new BOM character.

cd=iconv_open("utf-8", "unicode");
iconv(cd, unicode_string_with_bom, &srclen, &target, &targetlen); /* ok */
iconv(cd, 0, 0, 0, 0); /* this should reset the state of cd */
iconv(cd, unicode_string_with_bom, &srclen, &target, &targetlen); /* this now fails*
Comment 1 Ulrich Drepper 2007-08-21 14:43:30 UTC
Fixed in cvs.