diff options
author | Richard Weickelt <richard@weickelt.de> | 2020-11-24 01:14:28 +0100 |
---|---|---|
committer | Richard Weickelt <richard@weickelt.de> | 2020-11-25 14:06:11 +0100 |
commit | 810a0afe1e9bd14e4393a73bf6c299b25745dbc5 (patch) | |
tree | 127834204e459c6c368ce82f9236e6bd66a669a2 /src/qml/jsruntime/qv4proxy.cpp | |
parent | 89ea9f1f9468aa47718cbb398317c63a9479adf2 (diff) |
Fix crash when calling hasOwnProperty() on proxy object
Property pointer p needs to be checked for nullptr value in
QV4::ProxyObject::virtualGetOwnProperty(). This can happen when calling
hasOwnProperty() or propertyIsEnumerable().
Fixes: QTBUG-88786
Change-Id: I43da58fed4d8656f9187213f7317f17398739e34
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 9b321a34490cd17c0eb043b69bd7c9d8d8f513d5)
Reviewed-by: Richard Weickelt <richard@weickelt.de>
Diffstat (limited to 'src/qml/jsruntime/qv4proxy.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4proxy.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4proxy.cpp b/src/qml/jsruntime/qv4proxy.cpp index 24676ffd00..1505eae426 100644 --- a/src/qml/jsruntime/qv4proxy.cpp +++ b/src/qml/jsruntime/qv4proxy.cpp @@ -265,9 +265,9 @@ PropertyAttributes ProxyObject::virtualGetOwnProperty(const Managed *m, Property ScopedProperty targetDesc(scope); PropertyAttributes targetAttributes = target->getOwnProperty(id, targetDesc); if (trapResult->isUndefined()) { - p->value = Encode::undefined(); - if (targetAttributes == Attr_Invalid) { + if (p) p->value = Encode::undefined(); + if (targetAttributes == Attr_Invalid) { return Attr_Invalid; } if (!targetAttributes.isConfigurable() || !target->isExtensible()) { @@ -295,8 +295,10 @@ PropertyAttributes ProxyObject::virtualGetOwnProperty(const Managed *m, Property } } - p->value = resultDesc->value; - p->set = resultDesc->set; + if (p) { + p->value = resultDesc->value; + p->set = resultDesc->set; + } return resultAttributes; } |