Created
November 7, 2018 14:12
-
-
Save apankrat/ce6d15e5a6aac681257257ad5809ca9b 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
/* | |
* This will execute and exit cleanly despite of | |
* dereferencing a zero pointer in line 12 ... | |
*/ | |
#include <windows.h> | |
#include <stdio.h> | |
void __stdcall OnTimer(HWND, UINT, UINT_PTR, DWORD) | |
{ | |
printf("Tick\n"); | |
*(int*)0 = 0; /* trip 'access denied' */ | |
printf("Tock\n"); | |
} | |
int wmain(int argc, wchar_t ** argv) | |
{ | |
MSG msg = { 0 }; | |
SetTimer(NULL, 0x1234, 1000, OnTimer); | |
GetMessage(&msg, NULL, 0, 0); | |
DispatchMessage(&msg); | |
printf("Done\n"); | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment