diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-07-07 23:08:15 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-07-08 08:46:59 +0200 |
commit | 853b9f15f892f340bbe1fbbebeb93cb8078da1f9 (patch) | |
tree | fa223dcdc2d95b765a78535e56cb68a825448ddb | |
parent | 6f05cddf4676225cb76f160ae44857373869acb0 (diff) |
vm: fix potential invalid memory access in uc_vm_get_error_context()
If there's only native function calls on the call stack, the code
incorrectly accessed an invalid memory location.
Avoid that issue by stopping the search for non-native callframes
before the last frame.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | vm.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -807,7 +807,7 @@ uc_vm_get_error_context(uc_vm *vm) size_t offset, i; /* skip to first non-native function call frame */ - for (i = vm->callframes.count; i > 0; i--) + for (i = vm->callframes.count; i > 1; i--) if (vm->callframes.entries[i - 1].closure) break; |