summaryrefslogtreecommitdiffhomepage
path: root/vm.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-09-24 09:56:04 +0200
committerJo-Philipp Wich <jo@mein.io>2021-09-24 09:56:04 +0200
commitce4a7d96a648d37a95ebe07dfef522073c1b2fae (patch)
treec736345a8db0702b7b6804c1479e180cb2014352 /vm.c
parent218e8221a80a8fcf8bfd6cc115d7a0ae00a65ead (diff)
vm: reset callframes before invoking unhandled exception handler
Reset all callframes when dealing with an unhandled exception to avoid resuming the code which raised the exception when restarting the VM later, e.g. through uc_vm_call() or uc_vm_invoke(). Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/vm.c b/vm.c
index 2c8f524..65d6c81 100644
--- a/vm.c
+++ b/vm.c
@@ -2278,6 +2278,8 @@ uc_vm_execute_chunk(uc_vm_t *vm)
while (!uc_vm_handle_exception(vm)) {
/* no further callframe to pop, report unhandled exception and terminate */
if (vm->callframes.count <= 1) {
+ uc_vm_reset_callframes(vm);
+
if (vm->exhandler)
vm->exhandler(vm, &vm->exception);