From: Scott Wheeler Date: Sat, 29 May 2004 20:12:36 +0000 (+0000) Subject: Don't die on invalid input. X-Git-Tag: v1.5~385 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=05e484830cacc8b996a73fb004fb9fbbf65c8a48;p=taglib Don't die on invalid input. git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@315934 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- diff --git a/toolkit/tstring.cpp b/toolkit/tstring.cpp index 6670c20d..0d6b3cce 100644 --- a/toolkit/tstring.cpp +++ b/toolkit/tstring.cpp @@ -158,6 +158,9 @@ String::String(const ByteVector &v, Type t) { d = new StringPrivate; + if(v.isEmpty()) + return; + if(t == Latin1 || t == UTF8) { int length = 0; @@ -175,7 +178,7 @@ String::String(const ByteVector &v, Type t) wstring::iterator targetIt = d->data.begin(); for(ByteVector::ConstIterator it = v.begin(); - it + 1 != v.end() && combine(*it, *(it + 1)); + it != v.end() && it + 1 != v.end() && combine(*it, *(it + 1)); it += 2) { *targetIt = combine(*it, *(it + 1));