diff options
author | Evgeniy A. Dushistov <dushistov@mail.ru> | 2020-08-20 00:33:18 +0300 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-08-22 18:53:37 +0200 |
commit | b953bd67d4134b9af3e554a0287a462ddf2de5f7 (patch) | |
tree | 81e6b545c8e5a813fa643e8824073ff4e4396f6b /tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | |
parent | 3aa4cd682f52b70803cc3f72d732bde9987677dd (diff) |
QQmlObjectCreator: fix member func call with this == nullptr
The test example is based on
qtvirtualkeyboard/src/virtualkeyboard/content/components/PopupList.qml
Luckily ((QQmlPropertyCache *)nullptr) -> property(-1)
is ended without access to this, so this was not caught before.
But this is UB, plus I can not run Qt and my application compiled with
-fsanitizer=X, because of it crashed after the first member function
call with nullptr as this
Fixes: QTBUG-85605
Change-Id: If6a71fde9a14cc4f73139dfa0e6ee3005453104d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index b67ee148f4..e5ac59f379 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -333,6 +333,7 @@ private slots: void arrayToContainer(); void qualifiedScopeInCustomParser(); + void accessNullPointerPropertyCache(); void checkUncreatableNoReason(); @@ -5951,6 +5952,15 @@ void tst_qqmllanguage::checkURLtoURLObject() QCOMPARE(c.errors().count(), 0); } +void tst_qqmllanguage::accessNullPointerPropertyCache() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("NullPointerPropertyCache.qml")); + QVERIFY(c.isReady()); + QScopedPointer<QObject> obj(c.create()); + QVERIFY(!obj.isNull()); +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" |