GME  13
CrashTest.cpp
Go to the documentation of this file.
00001 
00002 //
00003 // CrashTest.cpp : Nasty functions which cause various crashes
00004 //
00006 
00007 #include "stdafx.h"
00008 #include "CrashTest.h"
00009 
00010 static  CrashTest       g_CrashTester;  // Global instance of CrashTest
00011 
00012 CrashTest::CrashTest()
00013 {
00014 }
00015 
00016 CrashTest::~CrashTest()
00017 {
00018 }
00019 
00020 void CrashTest::IllegalWrite(void)
00021 {
00022         char *p = 0;    // Null pointer.
00023         char x = 0;
00024 
00025         *p = x;
00026 }
00027 
00028 void CrashTest::IllegalRead(void)
00029 {
00030         char *p = 0;    // Null pointer.
00031         char x = 0;
00032 
00033         x = *p;
00034 }
00035 
00036 void CrashTest::IllegalReadInCRuntime(void)
00037 {
00038         strcpy(0, 0);
00039 }
00040 
00041 typedef void (*tBogusFunction)();
00042 
00043 void CrashTest::IllegalCodeRead(void)
00044 {
00045         tBogusFunction BadFunc = (tBogusFunction) 0;
00046         BadFunc();
00047 }
00048 
00049 void CrashTest::DivideByZero(void)
00050 {
00051         int y = 0;
00052 
00053         y = y / y;
00054 }
00055 
00056 void CrashTest::Abort(void)
00057 {
00058         abort();
00059 }
00060 
00061 void CrashTest::Terminate(void)
00062 {
00063         terminate();
00064 }