[Samba] Conversion error: Illegal multibyte sequence

Laurent Blume laurent+samba at elanor.org
Fri Sep 6 13:40:25 MDT 2013

On 2013-09-05 11:34 PM, Jeremy Allison wrote:
> No, it doesn't make sense. smb_iconv() vectors
> through pull and push function pointers that
> do the actual conversion - that's where the
> errno is coming from. That's why you need
> debug statements - you know it's going into
> smb_iconv() but you don't know where it's
> going from there.
> Jeremy.

At least those proved that neither Solaris' nor GNU's iconv were
involved :-)

I tagged all the possibles causes for EILSEQ, so here's the code causing
that issue, in lib/util/charset/iconv.c:

                if ((c[0] & 0xf0) == 0xe0) {
                        if (in_left < 3 ||
                            (c[1] & 0xc0) != 0x80 ||
                            (c[2] & 0xc0) != 0x80) {
                                errno = EILSEQ;
                                DEBUG(3,("DEBUG, %d, %d, %d, %d\n",
in_left, c[0], c[1], c[2]));
                                goto error;

It happens because in_left == 2 when it should be 3:

[2013/09/06 20:59:50.249004,  3] ../lib/util/charset/iconv.c:600(utf8_pull)
  DEBUG, 2, 226, 153, 187
[2013/09/06 20:59:50.249056,  3] lib/charcnv.c:161(convert_string_internal)
  convert_string_internal: Conversion error: Illegal multibyte

The sequence values are good, as this char is 0xE2 0x99 0xBB in UTF8.

I tried to backtrack the origin of this value, but I got lost after
convert_string_internal() in source3/lib/charcnv.c , where it was
incorrect already.

Is it getting warmer?


More information about the samba mailing list