-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
PLH::BreakPointHook crashes when exception handled #90
Comments
Hi, thanks for reporting this and providing such a clean reproduction case! I've identified the bug, in a recent commit I introduced the ability to provide a custom filter callback so users gain more control over how the root exception handler works. This handler is invoked here: PolyHook_2_0/sources/AVehHook.cpp Line 49 in 84d6be2
Unfortunately I somehow forgot the case of when users do not use this. What occurs is that an empty std::function eventually gets invoked which is a big no-no and that then throws a C++ exception. But this exception isn't obvious because we threw it from an exception handler, which tries to handle it by calling into the exception handler again, which throws another one! This cycle of throwing and catching occurs forever until the stack overflows and eventually is caught by _chkstack which crashes the program with an invalid read. Fun! I will fix this soon. In the meantime as a workaround, please try to define an empty handler with this logic:
|
You will need to wait for microsoft to merge this PR before you can use vcpkg to install polyhook. Though you can mirror these changes locally in your own portfile and uninstall then reinstall polyhook via vcpkg to immediately get the update. |
Top notch report, thanks! |
PLH::BreakPointHook crashes the program when the hooked function is called.
Environment
Code (x64 Release)
Repository: https://github.com/automata172/polyhook-veh-crash
The text was updated successfully, but these errors were encountered: