diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2011-03-18 15:51:05 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2011-03-22 14:51:46 (GMT) |
commit | d2db4085bedf7c10791960bcbaf2da03d9860c5a (patch) | |
tree | b67980bf0429ab54a9f9b9ae6981039672d36138 /tests/benchmarks | |
parent | 168d7f8b7620756d07b96c04848ae497a213b523 (diff) | |
download | Qt-d2db4085bedf7c10791960bcbaf2da03d9860c5a.zip Qt-d2db4085bedf7c10791960bcbaf2da03d9860c5a.tar.gz Qt-d2db4085bedf7c10791960bcbaf2da03d9860c5a.tar.bz2 |
Add some boundary/spill protection
Diffstat (limited to 'tests/benchmarks')
-rw-r--r-- | tests/benchmarks/corelib/tools/qstring/main.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/tools/qstring/main.cpp index b3ab175..c8d9de2 100644 --- a/tests/benchmarks/corelib/tools/qstring/main.cpp +++ b/tests/benchmarks/corelib/tools/qstring/main.cpp @@ -1499,12 +1499,16 @@ static void fromLatin1Alternatives_internal(FromLatin1Function function, bool do int len = entries[i].len; const char *src = fromLatin1Data.charData + entries[i].offset1; - QString dst; - dst.resize(len); - (function)(&dst.data()->unicode(), src, len); + QString dst(len + 16, QChar('x')); + (function)(&dst.data()->unicode() + 8, src, len); if (doVerify) { - QCOMPARE(dst, QString::fromLatin1(src, len)); + QString zeroes(8, QChar('x')); + QString final = dst.mid(8); + final.chop(8); + QCOMPARE(final, QString::fromLatin1(src, len)); + QCOMPARE(dst.left(8), zeroes); + QCOMPARE(dst.right(8), zeroes); } } } |