On Mon, Oct 07, 2013 at 08:10:33PM +0200, Enrico Forestieri wrote: > > The problem here is that to_utf8() (and most probably all other > conversion routines) is not thread safe, maybe due to the static > output buffer in iconv_convert().
Yes, this seems to be the case. The attached alternative patch also avoids the bug, but I did not investigate what possible side effects it may have. -- Enrico
diff --git a/src/support/unicode.cpp b/src/support/unicode.cpp index 95415a5..6bc6474 100644 --- a/src/support/unicode.cpp +++ b/src/support/unicode.cpp @@ -228,7 +228,7 @@ iconv_convert(IconvProcessor & processor, InType const * buf, size_t buflen) char const * inbuf = reinterpret_cast<char const *>(buf); size_t inbytesleft = buflen * sizeof(InType); - static std::vector<char> outbuf(32768); + std::vector<char> outbuf(32768); // The number of UCS4 code points in buf is at most inbytesleft. // The output encoding will use at most // max_encoded_bytes(pimpl_->tocode_) per UCS4 code point.
