aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4jscall_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-07-21 15:02:02 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-07-22 09:08:25 +0200
commitc02b0e529a3266cce2f7d852deca7774402b236e (patch)
tree958f6978bc618a70dfe419f6c2be492307f6d92f /src/qml/jsruntime/qv4jscall_p.h
parent9e03741e54768f99dac166bd56b0e8cb6d85ca36 (diff)
Qml: When cloning a stack frame, also clone its instruction pointer
Otherwise we get an out of range access when looking for the line number. To be extra safe, we also add another guard against this to the lineNumber() function. Pick-to: 6.2 6.3 6.4 Fixes: QTBUG-90466 Change-Id: I4d9cb52ecba2631696537f02a3c1b75c3658ceb8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4jscall_p.h')
-rw-r--r--src/qml/jsruntime/qv4jscall_p.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4jscall_p.h b/src/qml/jsruntime/qv4jscall_p.h
index 014b0473a5..900ff7d2af 100644
--- a/src/qml/jsruntime/qv4jscall_p.h
+++ b/src/qml/jsruntime/qv4jscall_p.h
@@ -104,8 +104,12 @@ struct ScopedStackFrame
ScopedStackFrame(const Scope &scope, ExecutionContext *context)
: engine(scope.engine)
{
- frame.init(engine->currentStackFrame ? engine->currentStackFrame->v4Function : nullptr,
- nullptr, context, nullptr, nullptr, 0);
+ if (auto currentFrame = engine->currentStackFrame) {
+ frame.init(currentFrame->v4Function, nullptr, context, nullptr, nullptr, 0);
+ frame.instructionPointer = currentFrame->instructionPointer;
+ } else {
+ frame.init(nullptr, nullptr, context, nullptr, nullptr, 0);
+ }
frame.push(engine);
}