diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-01-28 15:15:34 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-03 11:46:52 +0200 |
commit | 11ff42af39f1b81e8e35451bf7128cbafd294da7 (patch) | |
tree | cf6dd41a3748f4117ed8d6edfa8e26ff1d711271 /src | |
parent | 50390b8bc3ec104ee84d88481aa743a05e8a4197 (diff) | |
download | qt4-tools-11ff42af39f1b81e8e35451bf7128cbafd294da7.tar.gz |
Fix QtScript crash on 64bit with JIT.
During back-trace generation we calculate a code offset towards JIT generated
code. Using JITCode::offsetOf() will crash/assert if the offset doesn't fit
into 32 bits, because the generated code can only encode relative offsets
in 32-bits and not 64-bits. However in this context - backtrace generation -
we just want to calculate the offset and are not interested in this
architectural limitation, therefore we can just calculate the offset ourselves
using the fully sized uintptr_t.
Initial-patch-by: Simon.Hausmann@digia.com
Task-number: QTCREATORBUG-8629
Task-number: QTBUG-23463
Change-Id: I0efadd5ed20855409122e1fcc9236fdfbc4f62a4
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
(cherry picked from qtscript/3b26f6f6643978c9d041a6267dc88e2a59ced763)
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/script/api/qscriptcontextinfo.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/script/api/qscriptcontextinfo.cpp b/src/script/api/qscriptcontextinfo.cpp index 43333bd0c8..5d46f4d8a6 100644 --- a/src/script/api/qscriptcontextinfo.cpp +++ b/src/script/api/qscriptcontextinfo.cpp @@ -160,7 +160,7 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte if (returnPC && codeBlock && QScriptEnginePrivate::hasValidCodeBlockRegister(frame)) { #if ENABLE(JIT) JSC::JITCode code = codeBlock->getJITCode(); - unsigned jitOffset = code.offsetOf(JSC::ReturnAddressPtr(returnPC).value()); + uintptr_t jitOffset = reinterpret_cast<uintptr_t>(JSC::ReturnAddressPtr(returnPC).value()) - reinterpret_cast<uintptr_t>(code.addressForCall().executableAddress()); // We can only use the JIT code offset if it's smaller than the JIT size; // otherwise calling getBytecodeIndex() is meaningless. if (jitOffset < code.size()) { |