1
0

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
This commit is contained in:
Dominique Leuenberger 2019-06-07 16:01:32 +00:00 committed by Git OBS Bridge
parent 55bafc191f
commit 00ede578e9
3 changed files with 91 additions and 2 deletions

View File

@ -0,0 +1,82 @@
From ea74f0c68cddf706c950d3910cf7b363fe24885b Mon Sep 17 00:00:00 2001
From: Ulf Hermann <ulf.hermann@qt.io>
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 <erik.verbruggen@qt.io>
---
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<QtObject> 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<v8::Value> 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<QObject> object(component.create());
+ QVERIFY(!object.isNull());
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Jun 4 14:50:38 UTC 2019 - Fabian Vogt <fabian@ritter-vogt.de>
- 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 Thu Apr 18 07:26:48 UTC 2019 - fabian@ritter-vogt.de

View File

@ -33,6 +33,8 @@ Url: https://www.qt.io
%define tar_version qtdeclarative-everywhere-src-5.12.3 %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 Source: https://download.qt.io/official_releases/qt/5.12/%{real_version}/submodules/%{tar_version}.tar.xz
Source1: baselibs.conf 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 # PATCH-FIX-OPENSUSE sse2_nojit.patch -- enable JIT and sse2 only on sse2 case
Patch100: sse2_nojit.patch Patch100: sse2_nojit.patch
# PATCH-FIX-OPENSUSE Switch to use python3 at build time # 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. handling.
%prep %prep
%setup -q -n %{tar_version} %autosetup -p1 -n %{tar_version}
%autopatch -p1
%package -n %libname %package -n %libname
Summary: Qt 5 Declarative Library Summary: Qt 5 Declarative Library