Home > Software engineering >  The CRT detected that the application demonstrate to the memory after the end of heap buffer what ca
The CRT detected that the application demonstrate to the memory after the end of heap buffer what ca

Time:10-06

 static int count=1; 
Static int m=0;
Printf (" please enter a string \ n ");
Char * * array1;
Array1=new char * [80].
While (true)
{
Out:

For (static int I=0; i <=count; + + I)
{
Array1 [I]=new char (count);
Memset (array1 [I], 0, the count * sizeof (char));
}
Cin. Getline (array1 [m], 80);
M++;
Count + +;
Ai:
Char * STR=new char [80];
Memset (STR, 0, 80);
Printf (" press enter to continue input, according to the input end of c \ n ");
Cin. Getline (STR, 80);
If (* STR=='c')
{
If (STR!=NULL)
The delete [] STR;
break;
}
Else if (* STR==0)
{
If (STR!=NULL)
The delete [] STR;
Goto out;
}
The else
{
If (STR!=NULL)
The delete [] STR;
Printf (" please input as required \ n ");
Goto ai;
}
}
For (int I=0; i{
If (array1 [I]!=NULL)
The delete [] array1 [I];
}
The delete [] array1;

return;

CodePudding user response:

Determine whether cross-border access, can be in after the last element of an array of the corresponding address set read and write data breakpoints, if the address corresponding to other variables interfere with the judgment, can be more declare an array element, and set the read and write data breakpoints on the corresponding address of the more elements,
 # include & lt; Time. H> 
#include
#include
Int main () {
Int a, b [11].//was b [10], to decide which words of cross-border, intentionally statement for b [11]

Srand ((unsigned int) time (NULL));//press F11 twice, such as yellow right arrow pointing to the bank, the debugging, the new breakpoint, new data breakpoints, address: & amp; B [10], byte count: 4, sure,
While (1) {//press F5, will stop in the following sentence, as a value of 10, b has been modified to corresponding to 0. [10]. One of the four,
B (11) (a=rand () %]=0;
Sleep (100);
B (11) (a=rand () %]=1;
Sleep (100);
B (11) (a=rand () %]=2;
Sleep (100);
B (11) (a=rand () %]=3;
Sleep (100);
B (11) (a=rand () %]=4;
Sleep (100);
}
return 0;
}
  • Related