diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2012-05-19 20:30:56 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-21 10:59:03 (GMT) |
commit | fe2d1518146242532d76f5ee353ab45a4aed29d2 (patch) | |
tree | f2a0d8efcd10b897bc48810d68ad58dc04cea8c1 /tests/auto/qregexp | |
parent | b26a588c1702a84ba853df3c757d879cc9f2fc46 (diff) | |
download | Qt-fe2d1518146242532d76f5ee353ab45a4aed29d2.zip Qt-fe2d1518146242532d76f5ee353ab45a4aed29d2.tar.gz Qt-fe2d1518146242532d76f5ee353ab45a4aed29d2.tar.bz2 |
QRegExp: fix autotest, fix usage of uninitialized values
A (probable) typo was causing the code dealing with anchors
to use uninitialized values. This used to work by chance, but was
indeed detected by Valgrind f.i. when running tst_qregexp --
the indexIn test on anc11 data reported:
==3015== Conditional jump or move depends on uninitialised value(s)
==3015== at 0x514B4EA: PeppeQt::QRegExpMatchState::testAnchor(int, int, int const*) (qregexp.cpp:1813)
[...]
==3015== Uninitialised value was created by a stack allocation
==3015== at 0x514B3EB: PeppeQt::QRegExpMatchState::testAnchor(int, int, int const*) (qregexp.cpp:1803)
Fixing the code also makes the aforementioned test to succeed,
therefore the #if 0 sections can be droppped.
Backport of commits 281771ee201e591d4f40a161b93c71914b1b38f2
and 1fe7e557d75962c9c79cc344037a02ed50369430 from qtbase.
Change-Id: I4d6cffdae737def1a47e72b46e40979e0aee1719
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: hjk <qthjk@ovi.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tests/auto/qregexp')
-rw-r--r-- | tests/auto/qregexp/tst_qregexp.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/tests/auto/qregexp/tst_qregexp.cpp b/tests/auto/qregexp/tst_qregexp.cpp index d444558..051eb8e 100644 --- a/tests/auto/qregexp/tst_qregexp.cpp +++ b/tests/auto/qregexp/tst_qregexp.cpp @@ -170,12 +170,10 @@ void tst_QRegExp::indexIn_data() << QStringList(); QTest::newRow( stri + "anc09" ) << QString("a(?:(?!)|b)z") << QString("abz") << 0 << 3 << QStringList(); -#if 0 - QTest::newRow( stri + "anc10" ) << QString("a?(?=^b$)") << QString("ab") << 0 << 1 + QTest::newRow( stri + "anc10" ) << QString("a?(?=^b$)") << QString("ab") << -1 << -1 << QStringList(); QTest::newRow( stri + "anc11" ) << QString("a?(?=^b$)") << QString("b") << 0 << 0 << QStringList(); -#endif // back-references QTest::newRow( stri + "bref00" ) << QString("(a*)(\\1)") << QString("aaaaa") << 0 << 4 |