Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicorn does not recover from an invalid instruction hook #2047

Closed
elicn opened this issue Oct 29, 2024 · 1 comment
Closed

Unicorn does not recover from an invalid instruction hook #2047

elicn opened this issue Oct 29, 2024 · 1 comment

Comments

@elicn
Copy link
Contributor

elicn commented Oct 29, 2024

Hooking invalid instructions is essential for various purposes, however Unicorn would not recover from a hooked invalid instruction. The UC_HOOK_INSN_INVALID hook handler returns a boolean which supposed to indicate whether the incident has been handled successfully, however it seems that Unicorn ignores that return value and throws an exception either way.

Unicorn is expected to honor the return value and resume emulation if it got an indication that the incident has been handled, while the handler is expected to modify the PC appropriately before returning.

Attached here is a regress test file that may placed in the regress folder to test this behavior (note the .txt extension).
invalid_insn.py.txt

@wtdcode
Copy link
Member

wtdcode commented Dec 7, 2024

Fixed in 69200d4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants