summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qstringbuilder
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2012-05-31 14:00:48 +1000
committerQt by Nokia <qt-info@nokia.com>2012-06-01 01:22:06 +0200
commitfbee9834dc0fa1838a38e552eddd941af1ef39ac (patch)
treead9db14e553a5026b6196073ce25f009b62ce391 /tests/auto/corelib/tools/qstringbuilder
parent1e778ebd06c37f7a81e4247a5998d06fa849eff8 (diff)
Fix crash in QStringBuilder when concatenating data-less QLatin1String
Previously, the append functions in QConcatenable in the QStringBuilder dereferenced the data() pointer of the argument QLatin1String without performing null check. Change-Id: I629f19fbce3113f1f80f4272fa7ae34e1dbc6bee Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto/corelib/tools/qstringbuilder')
-rw-r--r--tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
index 8955da97fa..c473017d36 100644
--- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
+++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
@@ -211,6 +211,13 @@ void runScenario()
str = (QString::fromUtf8(UTF8_LITERAL) += QLatin1String(LITERAL) P UTF8_LITERAL);
QCOMPARE(str, QString::fromUtf8(UTF8_LITERAL LITERAL UTF8_LITERAL));
#endif
+
+ QString str2 = QString::fromUtf8(UTF8_LITERAL);
+ QString str2_e = QString::fromUtf8(UTF8_LITERAL);
+ const char * nullData = 0;
+ str2 += QLatin1String(nullData) P str2;
+ str2_e += QLatin1String("") P str2_e;
+ QCOMPARE(str2, str2_e);
}
//operator QByteArray +=