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/jit/qv4isel_masm.cpp | |
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/jit/qv4isel_masm.cpp')
-rw-r--r-- | src/qml/jit/qv4isel_masm.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp index 3803a5e119..cf7205661d 100644 --- a/src/qml/jit/qv4isel_masm.cpp +++ b/src/qml/jit/qv4isel_masm.cpp @@ -449,7 +449,7 @@ void InstructionSelection<JITAssembler>::loadThisObject(IR::Expr *temp) { _as->loadPtr(Address(JITTargetPlatform::EngineRegister, JITAssembler::targetStructureOffset(offsetof(QV4::EngineBase, current))), JITTargetPlatform::ScratchRegister); _as->loadPtr(Address(JITTargetPlatform::ScratchRegister, qOffsetOf(ExecutionContext::Data, callData)), JITTargetPlatform::ScratchRegister); - _as->copyValue(temp, Address(JITTargetPlatform::ScratchRegister, qOffsetOf(CallData, thisObject))); + _as->copyValue(temp, Address(JITTargetPlatform::ScratchRegister, offsetof(CallData, thisObject))); } template <typename JITAssembler> @@ -1313,11 +1313,11 @@ int InstructionSelection<JITAssembler>::prepareCallData(IR::ExprList* args, IR:: ++argc; } - Pointer p = _as->stackLayout().callDataAddress(qOffsetOf(CallData, tag)); + Pointer p = _as->stackLayout().callDataAddress(offsetof(CallData, tag)); _as->store32(TrustedImm32(QV4::Value::Integer_Type_Internal), p); - p = _as->stackLayout().callDataAddress(qOffsetOf(CallData, argc)); + p = _as->stackLayout().callDataAddress(offsetof(CallData, argc)); _as->store32(TrustedImm32(argc), p); - p = _as->stackLayout().callDataAddress(qOffsetOf(CallData, thisObject)); + p = _as->stackLayout().callDataAddress(offsetof(CallData, thisObject)); if (!thisObject) _as->storeValue(QV4::Primitive::undefinedValue(), p); else |