From 1f056ae9e67a90cbbb6dc2a1c21ed7c361a5c108 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 22 Jun 2018 09:28:47 +0200 Subject: Add run time assertion for local handling Commit f44782d0cdbdb800d9c31d5aff712fbf29d52edc fixed the missing call context creation that would lead to language/statements/break/S12.8_A2.js failing. It wouldn't always fail as the invalid cast from the global context to a call context would access memory that happens to be available just for the test. An assertion however will not require us to rely on memory setup. Change-Id: I131a2242004cd5e4d518e58cc9f6a79037f962d2 Reviewed-by: Lars Knoll --- src/qml/jsruntime/qv4vme_moth.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index 18aae4bd32..f625368b62 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -559,12 +559,14 @@ QV4::ReturnedValue VME::interpret(CppStackFrame &frame, const char *code) MOTH_BEGIN_INSTR(LoadLocal) auto cc = static_cast(stack[CallData::Context].m()); + Q_ASSERT(cc->type != QV4::Heap::CallContext::Type_GlobalContext); acc = cc->locals[index].asReturnedValue(); MOTH_END_INSTR(LoadLocal) MOTH_BEGIN_INSTR(StoreLocal) CHECK_EXCEPTION; auto cc = static_cast(stack[CallData::Context].m()); + Q_ASSERT(cc->type != QV4::Heap::CallContext::Type_GlobalContext); QV4::WriteBarrier::write(engine, cc, cc->locals.values[index].data_ptr(), acc); MOTH_END_INSTR(StoreLocal) -- cgit v1.2.3