Created
October 26, 2020 18:51
-
-
Save Donpedro13/2ceeaa1c3cf75d6799d84c10bec8496f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Compile with MSVC, *Release* configuration | |
| #include <iostream> | |
| #include <new> | |
| #include <windows.h> | |
| LONG WINAPI MyUEF (PEXCEPTION_POINTERS pExp) | |
| { | |
| if (pExp->ExceptionRecord->ExceptionCode == STATUS_HEAP_CORRUPTION) { | |
| std::cout << "Heap corruption detected!" << std::endl; | |
| Sleep (5000); | |
| TerminateProcess (GetCurrentProcess (), pExp->ExceptionRecord->ExceptionCode); | |
| } | |
| return EXCEPTION_CONTINUE_SEARCH; | |
| } | |
| int main () | |
| { | |
| SetUnhandledExceptionFilter (MyUEF); | |
| delete reinterpret_cast<void*> (3); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment