aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2016-12-07 11:17:30 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2016-12-08 05:34:38 +0000
commit96d057e6a5138918c9f8b92ce3320042fa6417fc (patch)
treed687dfa6bca52f15a4412f90630bcf1cc97150fd
parente0a3c6276a257aeb1cb3ef6d16a4dddcc65d8195 (diff)
V4 Interpreter: reset the exception handler for every catch block
If an exception handler consists of multiple basic-blocks, and is then followed by a finally block (for example: a catch block with a throw followed by a return, and then a subsequent finally block), then the finally block can be reached before the exception handler is reset by skipping the second block of the catch handler with a throw. As the finally block will then rethrow, and the old exception handler is still there, it will end in an endless loop. The fix is to reset the exception handler for every catch block. The problem occurred in ch12/12.14/S12.14_A13_T3 Change-Id: I968b62c6c2af30af32e2717a9ce85f852523dbe8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index ca6319ef3c..f2bd57ad8f 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -242,6 +242,11 @@ void InstructionSelection::run(int functionIndex)
addInstruction(set);
}
exceptionHandler = _block->catchBlock;
+ } else if (_block->catchBlock == nullptr && _block->index() != 0 && _block->in.isEmpty()) {
+ exceptionHandler = nullptr;
+ Instruction::SetExceptionHandler set;
+ set.offset = 0;
+ addInstruction(set);
}
for (IR::Stmt *s : _block->statements()) {