diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2016-07-07 12:08:31 +0200 |
---|---|---|
committer | Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> | 2016-07-15 09:37:45 +0000 |
commit | 34de4f6a157ac10a434b719f41a06b4293023b29 (patch) | |
tree | f578f8b998d93ab3c374ef492ab7e332ea575354 /tests/auto/tools | |
parent | 9a00ae8e24a03b25476cc6200bddf4c8fc510733 (diff) |
moc: Fix a crash with malformed input
Do not increment 'data' past the buffer in case of invalid token.
Remove the left over qDebug so we can make a test.
Task-number: QTBUG-54609
Change-Id: I8f0dd3381fbdea3f07d3c05c9a44a16d92538117
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'tests/auto/tools')
-rw-r--r-- | tests/auto/tools/moc/tst_moc.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index b3f9a9f85f..9d2b883112 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -1935,6 +1935,13 @@ void tst_Moc::warnings_data() << 1 << QString("IGNORE_ALL_STDOUT") << QString(":2: Error: Macro invoked with too few parameters for a use of '#'"); + + QTest::newRow("QTBUG-54609: crash on invalid input") + << QByteArray::fromBase64("EAkJCQkJbGFzcyBjbGFzcyBiYWkcV2kgTUEKcGYjZGVmaW5lIE1BKFEs/4D/FoQ=") + << QStringList() + << 1 + << QString("IGNORE_ALL_STDOUT") + << QString(":-1: Error: Unexpected character in macro argument list."); } void tst_Moc::warnings() @@ -1950,7 +1957,7 @@ void tst_Moc::warnings() #ifdef Q_CC_MSVC // for some reasons, moc compiled with MSVC uses a different output format - QRegExp lineNumberRe(":(\\d+):"); + QRegExp lineNumberRe(":(-?\\d+):"); lineNumberRe.setMinimal(true); expectedStdErr.replace(lineNumberRe, "(\\1):"); #endif |