A
Antony
compiler£ºVisual Studio.Net 2003 (VC7.1)
compile type£ºDebug
problem: wanted more information about the "Run-Time Check Failure
#n",thanks!
Example1:
#include "stdafx.h"
void malice()
{
printf("Hey,you're been attacked.\n");
}
void foo()
{
int *ret;
ret=(int*)&ret+2;
(*ret)=(int)malice;
}
int _tmain(int argc, _TCHAR* argv[])
{
foo();
return 0;
}
Run this program,It prompt:
Run-Time Check Failure #0 - The value of ESP was not properly saved
across a function call. This is usually a result of calling a function
declared with one calling convention with a function pointer declared
with a different calling convention.
Example 2:
#include "stdafx.h"
void foo()
{
int var[2];
var[2] = 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
foo();
return 0;
}
Run this program,It prompt:
Run-Time Check Failure #2 - Stack around the variable 'var' was
corrupted.
Example 3:
#include "stdafx.h"
#include <iostream>
using namespace std;
int a,b;
int _tmain(int argc, _TCHAR* argv[])
{
int c;
cout<<a<<"\n";
cout<<b<<"\n";
cout<<c<<"\n";
return 0;
}
Run this program,It prompt:
Run-Time Check Failure #3 - The variable 'c' is being used without
being defined.
compile type£ºDebug
problem: wanted more information about the "Run-Time Check Failure
#n",thanks!
Example1:
#include "stdafx.h"
void malice()
{
printf("Hey,you're been attacked.\n");
}
void foo()
{
int *ret;
ret=(int*)&ret+2;
(*ret)=(int)malice;
}
int _tmain(int argc, _TCHAR* argv[])
{
foo();
return 0;
}
Run this program,It prompt:
Run-Time Check Failure #0 - The value of ESP was not properly saved
across a function call. This is usually a result of calling a function
declared with one calling convention with a function pointer declared
with a different calling convention.
Example 2:
#include "stdafx.h"
void foo()
{
int var[2];
var[2] = 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
foo();
return 0;
}
Run this program,It prompt:
Run-Time Check Failure #2 - Stack around the variable 'var' was
corrupted.
Example 3:
#include "stdafx.h"
#include <iostream>
using namespace std;
int a,b;
int _tmain(int argc, _TCHAR* argv[])
{
int c;
cout<<a<<"\n";
cout<<b<<"\n";
cout<<c<<"\n";
return 0;
}
Run this program,It prompt:
Run-Time Check Failure #3 - The variable 'c' is being used without
being defined.