Now I am debugging a large project, which has a stack corruption: the application fails.

I would like to know how to find (debug) such stack corruption code with Visual Studio 2010?

Here's an example of some code which causes stack problems, how would I find less obvious cases of this type of corruption?

void foo()
{
    int i = 10;
    int *p = &i;
    p[-2] = 100;
}

Update

Please note that this is just an example. I need to find such bad code in the current project.

Edit
Report