Fedora Account System
Red Hat Associate
Red Hat Customer
Trying to convert the invalid sequence "\x98\x8c" from SHIFT_JIS to UTF-8, iconv correctly returns -1 and sets errno to EILSEQ, however it advances input pointers, consuming the ill sequence. It should not. This is causing gnome-terminal to crash seeing that sequence at the end of input. I'm fixing the crasher in g-t, but the real bug is in iconv. g-t bug: http://bugzilla.gnome.org/show_bug.cgi?id=567064 Attaching test case.
Testcase is missing...
I've tried: #include <iconv.h> #include <assert.h> #include <errno.h> int main (void) { iconv_t i1 = iconv_open ("ISO-8859-1//", "UTF-8//"); iconv_t i2 = iconv_open ("UTF-8//", "SHIFT-JIS//"); char *inbuf, *outbuf, buf[64]; size_t inbytesleft, outbytesleft, res; inbuf = "\x83\x83\x83"; inbytesleft = 3; outbuf = buf; outbytesleft = 64; errno = 0; res = iconv (i1, &inbuf, &inbytesleft, &outbuf, &outbytesleft); assert (res == (size_t) -1 && errno == EILSEQ && inbytesleft == 3 && outbytesleft == 64); inbuf = "\xec\x98\x8c"; inbytesleft = 3; outbuf = buf; outbytesleft = 64; errno = 0; res = iconv (i2, &inbuf, &inbytesleft, &outbuf, &outbytesleft); assert (res == (size_t) -1 && errno == EILSEQ && inbytesleft == 3 && outbytesleft == 64); return 0; } but that works as expected.
Created attachment 341034 [details] test case Sorry. I'm sure I attached in the original report form... Anyway, seems to work for "\xec\x98\x8c", but not for "x\x98\x8c".
Should be fixed in glibc-2.9.90-22.
Thanks.