diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-04-07 15:55:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-07 15:55:22 +0200 |
commit | 72292e9a86ac32e64da54bf27d38553f52161b89 (patch) | |
tree | ded5336b2171f4811b86519228197b1546937cef /tests/custom/04_bugs | |
parent | 47ca65b9561b60960a38cce698ac830aff5d4e98 (diff) | |
parent | e0e9431c2715ec60b469258336bd6a35b344fee3 (diff) |
Merge pull request #68 from jow-/vm-callframe-double-free-fix
Diffstat (limited to 'tests/custom/04_bugs')
-rw-r--r-- | tests/custom/04_bugs/35_vm_callframe_double_free | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/custom/04_bugs/35_vm_callframe_double_free b/tests/custom/04_bugs/35_vm_callframe_double_free new file mode 100644 index 0000000..bb816eb --- /dev/null +++ b/tests/custom/04_bugs/35_vm_callframe_double_free @@ -0,0 +1,36 @@ +When invoking a native function as toplevel VM call which indirectly +triggers an unhandled exception in managed code, the callframes are +completely reset before the C function returns, leading to invalid +memory accesses when `uc_vm_call_native()` subsequently popped it's +own callframe again. + +This issue did not surface by executing script code through the +interpreter since in this case the VM will always execute a managed +code as toplevel call, but it could be triggered by invoking a native +function triggering an exception through the C API using `uc_vm_call()` +on a fresh `uc_vm_t` context or by utilizing the CLI interpreters `-l` +flag to preload a native code library triggering an exception. + + +-- File ex.uc -- +die("Exception"); +-- End -- + +-- Args -- +-L files/ -l ex +-- End -- + +-- Expect stderr -- +Exception +In main(), file files/ex.uc, line 1, byte 16: + called from anonymous function ([C]) + + `die("Exception");` + Near here -----^ + + +-- End -- + +-- Testcase -- +not reached +-- End -- |