diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-03-14 13:32:42 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-03-17 08:35:38 +0000 |
commit | 25e40b18d5348064e1b31d491a22c50a2ffb89c3 (patch) | |
tree | 12cfa8c8278429d07cf27733980e6e7ba72ab22f /src/qml/jsruntime/qv4scopedvalue_p.h | |
parent | 8e64fdf246a9076d4044e6c78af29e499f48905c (diff) |
Protect CallData usage against cross-compilation word size differences
Ensure via static asserts that the members always have the same offsets.
Since the class has standard layout, we can also use the C++11 offsetof
macro instead of qOffsetOf.
Task-number: QTBUG-58666
Change-Id: I7dcecf517c771c7081334cd9d0b7ae133b23b23a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4scopedvalue_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4scopedvalue_p.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h index 6775028272..894434be16 100644 --- a/src/qml/jsruntime/qv4scopedvalue_p.h +++ b/src/qml/jsruntime/qv4scopedvalue_p.h @@ -366,7 +366,7 @@ struct Scoped struct ScopedCallData { ScopedCallData(const Scope &scope, int argc = 0) { - int size = qMax(argc, (int)QV4::Global::ReservedArgumentCount) + qOffsetOf(QV4::CallData, args)/sizeof(QV4::Value); + int size = qMax(argc, QV4::Global::ReservedArgumentCount + int(offsetof(QV4::CallData, args)/sizeof(QV4::Value))); ptr = reinterpret_cast<CallData *>(scope.alloc(size)); ptr->tag = QV4::Value::Integer_Type_Internal; ptr->argc = argc; |