This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/14008] New: iconv behavior is incorrect when character is not present in dest charset


http://sourceware.org/bugzilla/show_bug.cgi?id=14008

             Bug #: 14008
           Summary: iconv behavior is incorrect when character is not
                    present in dest charset
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: unassigned@sourceware.org
        ReportedBy: bugdal@aerifal.cx
                CC: drepper.fsp@gmail.com
    Classification: Unclassified


Created attachment 6358
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6358
Test case showing the bug

Per POSIX:

"If iconv() encounters a character in the input buffer that is valid, but for
which an identical character does not exist in the target codeset, iconv()
shall perform an implementation-defined conversion on this character."

And:

"The iconv() function shall update the variables pointed to by the arguments to
reflect the extent of the conversion and return the number of non-identical
conversions performed. If the entire string in the input buffer is converted,
the value pointed to by inbytesleft shall be 0. If the input conversion is
stopped due to any conditions mentioned above, the value pointed to by
inbytesleft shall be non-zero and errno shall be set to indicate the condition.
If an error occurs, iconv() shall return (size_t)-1 and set errno to indicate
the error."

However, glibc's iconv is buggy and returns (size_t)-1 when a character from
the input character set does not exist in the output character set. I am
attaching a simple test program that shows the issue, based on incorrect test
code I found in glib:

https://bugzilla.gnome.org/show_bug.cgi?id=674540

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]