From 851a94dea5fd523b1c487e50eff41c8e56fd8c4d Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 1 Nov 2011 16:55:19 +1000 Subject: [PATCH] QDeclarativeStyledText::parse on empty tag causes assert in QString Task-number: QTBUG-22058 Change-Id: I7141002b751722ab34b378215251562153c4ff46 Reviewed-by: Yann Bodson --- src/declarative/util/qdeclarativestyledtext.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/declarative/util/qdeclarativestyledtext.cpp b/src/declarative/util/qdeclarativestyledtext.cpp index 872bad6..1c7ca5f 100644 --- a/src/declarative/util/qdeclarativestyledtext.cpp +++ b/src/declarative/util/qdeclarativestyledtext.cpp @@ -234,6 +234,8 @@ bool QDeclarativeStyledTextPrivate::parseTag(const QChar *&ch, const QString &te int tagLength = 0; while (!ch->isNull()) { if (*ch == greaterThan) { + if (tagLength == 0) + return false; QStringRef tag(&textIn, tagStart, tagLength); const QChar char0 = tag.at(0); if (char0 == QLatin1Char('b')) { @@ -343,6 +345,8 @@ bool QDeclarativeStyledTextPrivate::parseCloseTag(const QChar *&ch, const QStrin int tagLength = 0; while (!ch->isNull()) { if (*ch == greaterThan) { + if (tagLength == 0) + return false; QStringRef tag(&textIn, tagStart, tagLength); const QChar char0 = tag.at(0); hasNewLine = false; -- 2.7.4