From 05e484830cacc8b996a73fb004fb9fbbf65c8a48 Mon Sep 17 00:00:00 2001 From: Scott Wheeler Date: Sat, 29 May 2004 20:12:36 +0000 Subject: [PATCH] Don't die on invalid input. git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@315934 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- toolkit/tstring.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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));