public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/12601] New: iconv(3) doesn't handle invalid sequence properly
@ 2011-03-23  0:57 yukihiro.nakadaira at gmail dot com
  2011-05-14 15:39 ` [Bug libc/12601] " drepper.fsp at gmail dot com
  2014-06-27 13:20 ` fweimer at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: yukihiro.nakadaira at gmail dot com @ 2011-03-23  0:57 UTC (permalink / raw)
  To: glibc-bugs

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

           Summary: iconv(3) doesn't handle invalid sequence properly
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: yukihiro.nakadaira@gmail.com


When converting from cp932, iconv() doesn't handle invalid sequence properly.
See the following code.
iconv() returns -1 but inbuf is consumed.

I think it is the same issue with this.
http://sourceware.org/ml/libc-hacker/2009-04/msg00005.html
https://bugzilla.redhat.com/show_bug.cgi?id=497267



#include <stdio.h>
#include <errno.h>
#include <iconv.h>

int main()
{
    iconv_t cd;
    char in[] = "\x83\xd9";
    char out[256];
    char *inbuf;
    size_t inbytesleft;
    char *outbuf;
    size_t outbytesleft;
    size_t ret;

    inbuf = in;
    inbytesleft = sizeof(in) - 1;
    outbuf = out;
    outbytesleft = sizeof(out);

    cd = iconv_open("utf-8", "cp932");
    ret = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
    iconv_close(cd);

    printf("result: %ld %d %ld %d\n", ret, errno, inbytesleft, inbuf[0]);

    /*
     * result: -1 84 0 0        (84=EILSEQ)
     *
     * Error is returnd but inbuf is consumed.
     *
     * \x83\xd9 is valid shift-jis sequence but no character is assigned
     * to it.
     */

    return 0;
}

-- 
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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/12601] iconv(3) doesn't handle invalid sequence properly
  2011-03-23  0:57 [Bug libc/12601] New: iconv(3) doesn't handle invalid sequence properly yukihiro.nakadaira at gmail dot com
@ 2011-05-14 15:39 ` drepper.fsp at gmail dot com
  2014-06-27 13:20 ` fweimer at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: drepper.fsp at gmail dot com @ 2011-05-14 15:39 UTC (permalink / raw)
  To: glibc-bugs

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

Ulrich Drepper <drepper.fsp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #1 from Ulrich Drepper <drepper.fsp at gmail dot com> 2011-05-14 15:38:33 UTC ---
Fixed in git.

-- 
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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/12601] iconv(3) doesn't handle invalid sequence properly
  2011-03-23  0:57 [Bug libc/12601] New: iconv(3) doesn't handle invalid sequence properly yukihiro.nakadaira at gmail dot com
  2011-05-14 15:39 ` [Bug libc/12601] " drepper.fsp at gmail dot com
@ 2014-06-27 13:20 ` fweimer at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: fweimer at redhat dot com @ 2014-06-27 13:20 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=12601

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-27 13:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-23  0:57 [Bug libc/12601] New: iconv(3) doesn't handle invalid sequence properly yukihiro.nakadaira at gmail dot com
2011-05-14 15:39 ` [Bug libc/12601] " drepper.fsp at gmail dot com
2014-06-27 13:20 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).