From: Georg Baum Date: Thu, 28 Dec 2006 07:35:57 +0000 (+0000) Subject: * src/support/unicode.C X-Git-Tag: 1.6.10~11436 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=63524a4184e7f89ee7d6b26e26b45dcdd351501b;p=features.git * src/support/unicode.C (iconv_convert): Fix a crash: Don't try to create a vector from two pointers where end is before begin. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16408 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/support/unicode.C b/src/support/unicode.C index 6e814a7b9f..0ddeadffbc 100644 --- a/src/support/unicode.C +++ b/src/support/unicode.C @@ -203,6 +203,10 @@ iconv_convert(IconvProcessor & processor, char * outbuf = out; int bytes = processor.convert(inbuf, inbytesleft, outbuf, outsize); + if (bytes <= 0) + // Conversion failed + // FIXME Maybe throw an exception and handle that in the caller? + return std::vector(); RetType const * tmp = reinterpret_cast(out); return std::vector(tmp, tmp + bytes / sizeof(RetType));