Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*
* 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
You can’t perform that action at this time.