After more debugging, I found that the problem is when
iconv (cd, NULL, NULL, &outbuf, &outleft) tries to
flush the buffer to outbuf, but outbuf isn't big enough to
hold it.
This little patch to the charset_convert function seems to
fix this problem (works for me):
diff --git a/gmime/gmime-utils.c b/gmime/gmime-utils.c
index ca32b61..093deee 100644
--- a/gmime/gmime-utils.c
+++ b/gmime/gmime-utils.c
@@ -1553,7 +1553,15 @@ charset_convert (iconv_t cd, const
char *inbuf, size_t inleft, char **outp, size
}
} while (inleft > 0);
- iconv (cd, NULL, NULL, &outbuf,
&outleft);
+ while (iconv (cd, NULL, NULL, &outbuf,
&outleft) == (size_t) -1)
+ if (errno == E2BIG) {
+ outlen += 16;
+ rc = (size_t) (outbuf - out);
+ out = g_realloc (out, outlen +
1);
+ outleft = outlen - rc;
+ outbuf = out + rc;
+ }
+
*outbuf++ = '\0';
*outlenp = outlen;
</patch>
Best Regards