Discus the symptoms and an example of memory overrun bug class.
Symptoms:
The array only has 50 slots available in its allocation. What happens at that point is that the function goes past the end of the array and starts to walk on things beyond its control.
const kMaxEntries = 50;
int gArray[kMaxEntries];
char szDummyBuffer[256];
int nState = 10;
int ZeroArray (int *pArray)
{
for (inti=0;i<100;++i)
pArray[i] = 0;
- Program crashes quite regularly after a given routine is called, that routine should be examined for a possible overrun condition.
- If the routine in question does not appear to have any such problem the most likely cause is that another routine, called in the prior sequence, has already trashed variables or memory blocks.
- Checking the trace log of the called routines leading up to one with the problem will often show up the error.
The array only has 50 slots available in its allocation. What happens at that point is that the function goes past the end of the array and starts to walk on things beyond its control.
const kMaxEntries = 50;
int gArray[kMaxEntries];
char szDummyBuffer[256];
int nState = 10;
int ZeroArray (int *pArray)
{
for (inti=0;i<100;++i)
pArray[i] = 0;
0 Comments
Please add nice comments or answer ....