From 00ede578e9c7f4d29f2bebf7444f75abf54fe5ecbb417076fa0a04d911010105 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Fri, 7 Jun 2019 16:01:32 +0000 Subject: [PATCH] Accepting request 707637 from KDE:Qt5 - Add patch to fix crash (QTBUG-75203): * Dont-crash-when-accessing-invalid-properties.patch OBS-URL: https://build.opensuse.org/request/show/707637 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtdeclarative?expand=0&rev=53 --- ...sh-when-accessing-invalid-properties.patch | 82 +++++++++++++++++++ libqt5-qtdeclarative.changes | 6 ++ libqt5-qtdeclarative.spec | 5 +- 3 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 Dont-crash-when-accessing-invalid-properties.patch diff --git a/Dont-crash-when-accessing-invalid-properties.patch b/Dont-crash-when-accessing-invalid-properties.patch new file mode 100644 index 0000000..54f4df8 --- /dev/null +++ b/Dont-crash-when-accessing-invalid-properties.patch @@ -0,0 +1,82 @@ +From ea74f0c68cddf706c950d3910cf7b363fe24885b Mon Sep 17 00:00:00 2001 +From: Ulf Hermann +Date: Wed, 17 Apr 2019 12:35:42 +0200 +Subject: [PATCH] Don't crash when accessing invalid properties through + QObjectWrapper + +Change-Id: I613bf5dc685bb4235262b429d8f7318ea144fb9d +Fixes: QTBUG-75203 +Reviewed-by: Erik Verbruggen +--- + src/qml/jsruntime/qv4qobjectwrapper.cpp | 2 +- + .../undefinedPropertiesInObjectWrapper.qml | 20 +++++++++++++++++++ + .../qml/qqmlecmascript/tst_qqmlecmascript.cpp | 10 ++++++++++ + 3 files changed, 31 insertions(+), 1 deletion(-) + create mode 100644 tests/auto/qml/qqmlecmascript/data/undefinedPropertiesInObjectWrapper.qml + +Index: qtdeclarative-everywhere-src-5.12.3/src/qml/jsruntime/qv4qobjectwrapper.cpp +=================================================================== +--- qtdeclarative-everywhere-src-5.12.3.orig/src/qml/jsruntime/qv4qobjectwrapper.cpp ++++ qtdeclarative-everywhere-src-5.12.3/src/qml/jsruntime/qv4qobjectwrapper.cpp +@@ -856,7 +856,7 @@ ReturnedValue QObjectWrapper::virtualRes + if (!ddata || !ddata->propertyCache) { + QQmlPropertyData local; + QQmlPropertyData *property = QQmlPropertyCache::property(engine->jsEngine(), qobj, name, qmlContext, local); +- return getProperty(engine, qobj, property); ++ return property ? getProperty(engine, qobj, property) : QV4::Encode::undefined(); + } + QQmlPropertyData *property = ddata->propertyCache->property(name.getPointer(), qobj, qmlContext); + +Index: qtdeclarative-everywhere-src-5.12.3/tests/auto/qml/qqmlecmascript/data/undefinedPropertiesInObjectWrapper.qml +=================================================================== +--- /dev/null ++++ qtdeclarative-everywhere-src-5.12.3/tests/auto/qml/qqmlecmascript/data/undefinedPropertiesInObjectWrapper.qml +@@ -0,0 +1,20 @@ ++import QtQuick 2.12 ++ ++QtObject { ++ property list entries: [ ++ QtObject { ++ readonly property color color: "green" ++ }, ++ QtObject { ++ } ++ ] ++ ++ property Row row: Row { ++ Repeater { ++ model: entries ++ Rectangle { ++ color: model.color ? model.color : "red" ++ } ++ } ++ } ++} +Index: qtdeclarative-everywhere-src-5.12.3/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +=================================================================== +--- qtdeclarative-everywhere-src-5.12.3.orig/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp ++++ qtdeclarative-everywhere-src-5.12.3/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +@@ -366,6 +366,7 @@ private slots: + void tailCallWithArguments(); + void deleteSparseInIteration(); + void saveAccumulatorBeforeToInt32(); ++ void undefinedPropertiesInObjectWrapper(); + + private: + // static void propertyVarWeakRefCallback(v8::Persistent object, void* parameter); +@@ -8941,6 +8942,15 @@ void tst_qqmlecmascript::saveAccumulator + QCOMPARE(value.toString(), QLatin1String("RangeError: Maximum call stack size exceeded.")); + } + ++void tst_qqmlecmascript::undefinedPropertiesInObjectWrapper() ++{ ++ QQmlEngine engine; ++ QQmlComponent component(&engine, testFile("undefinedPropertiesInObjectWrapper.qml")); ++ QVERIFY(component.isReady()); ++ QScopedPointer object(component.create()); ++ QVERIFY(!object.isNull()); ++} ++ + QTEST_MAIN(tst_qqmlecmascript) + + #include "tst_qqmlecmascript.moc" diff --git a/libqt5-qtdeclarative.changes b/libqt5-qtdeclarative.changes index d8433dd..581363f 100644 --- a/libqt5-qtdeclarative.changes +++ b/libqt5-qtdeclarative.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Jun 4 14:50:38 UTC 2019 - Fabian Vogt + +- Add patch to fix crash (QTBUG-75203): + * Dont-crash-when-accessing-invalid-properties.patch + ------------------------------------------------------------------- Thu Apr 18 07:26:48 UTC 2019 - fabian@ritter-vogt.de diff --git a/libqt5-qtdeclarative.spec b/libqt5-qtdeclarative.spec index 874c334..fc58ba6 100644 --- a/libqt5-qtdeclarative.spec +++ b/libqt5-qtdeclarative.spec @@ -33,6 +33,8 @@ Url: https://www.qt.io %define tar_version qtdeclarative-everywhere-src-5.12.3 Source: https://download.qt.io/official_releases/qt/5.12/%{real_version}/submodules/%{tar_version}.tar.xz Source1: baselibs.conf +# PATCH-FIX-UPSTREAM +Patch1: Dont-crash-when-accessing-invalid-properties.patch # PATCH-FIX-OPENSUSE sse2_nojit.patch -- enable JIT and sse2 only on sse2 case Patch100: sse2_nojit.patch # PATCH-FIX-OPENSUSE Switch to use python3 at build time @@ -68,8 +70,7 @@ This package contains base tools, like string, xml, and network handling. %prep -%setup -q -n %{tar_version} -%autopatch -p1 +%autosetup -p1 -n %{tar_version} %package -n %libname Summary: Qt 5 Declarative Library