From 63524a4184e7f89ee7d6b26e26b45dcdd351501b Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Thu, 28 Dec 2006 07:35:57 +0000 Subject: [PATCH] * 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 --- src/support/unicode.C | 4 ++++ 1 file changed, 4 insertions(+) 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)); -- 2.39.2