Fix unaligned memory access on ARM
When decoding the bytecode, we must be careful to avoid that the
compiler generates aligned memory access instructions, because the
current byte code pointer may not be aligned at all.
When decoding integer parameters, the existing code would expland to
qFromLittleEndian(reinterpret_cast<const int>(code)[-nargs+offset])
which loads the integer from the array before passing it by value to
qFromLittleEndian.
[ChangeLog][QtQml] Fix crashes with unaligned memory access on ARM.
Task-number: QTBUG-69328
Change-Id: Ib1c66113e2b8e103ad6f5de11443a561d23a4185
Reviewed-by: Bhushan Shah <bshah@kde.org>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
This commit is contained in:
parent
6c2665edba
commit
d7b22cefde
|
|
@ -347,7 +347,7 @@ QT_BEGIN_NAMESPACE
|
|||
nargs,
|
||||
|
||||
#define MOTH_DECODE_ARG(arg, type, nargs, offset) \
|
||||
arg = qFromLittleEndian<type>(reinterpret_cast<const type *>(code)[-nargs + offset]);
|
||||
arg = qFromLittleEndian<type>(qFromUnaligned<type>(reinterpret_cast<const type *>(code) - nargs + offset));
|
||||
#define MOTH_ADJUST_CODE(type, nargs) \
|
||||
code += static_cast<quintptr>(nargs*sizeof(type) + 1)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue