summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-07-07 23:08:15 +0200
committerJo-Philipp Wich <jo@mein.io>2021-07-08 08:46:59 +0200
commit853b9f15f892f340bbe1fbbebeb93cb8078da1f9 (patch)
treefa223dcdc2d95b765a78535e56cb68a825448ddb
parent6f05cddf4676225cb76f160ae44857373869acb0 (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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index 9d97c0c..083c418 100644
--- a/vm.c
+++ b/vm.c
@@ -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;