Stack Corruption and app disappearing issue-- seh --

  • Thread starter Thread starter Humber Consumer
  • Start date Start date
H

Humber Consumer

I have a simple question.
I have following piece of code in a sample MFC application:

void CSampleAppDlg::OnButton1()
{
try
{ char e[1];

strcpy(e,"asdsadadsadsadsdsasdadsasdasdasadsadsadsadsadsaad");
}
catch(...)
{
::OutputDebugString("Error");
}
}

the application disappears without any error. I don't even see the
trace string

Yes, the stack got corrupted . I tried to use SEH

__try {
char e[1];
strcpy(e,"asdsadadsadsadsdsasdadsasdasdasadsadsadsadsadsaad");
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
::OutputDebugString("Error");
}

still same behavior...

However when I try

__try {
char e[1];
strcpy(e,"A very long string to test stack corruption.........test
stack corruption.........");
}
finally {
::OutputDebugString("Error");
}

I see "Error" in the debug trace...


My question is this:

What should I do to catch an error like that in an application

Is there anything I can do so that I can catch such an error where it
happens without the application disappearing?
 
Humber Consumer said:
I have a simple question.
I have following piece of code in a sample MFC application:

I think you're in the wrong group: this is the C# group, and your code
was definitely not C#!

Were you after microsoft.public.dotnet.languages.vc perhaps?
 
Back
Top