473,405 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Stack Corruption and app disappearing issue-- seh --

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,"asdsadadsadsadsdsasdadsasdasdasadsadsads adsadsaad");
}
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,"asdsadadsadsadsdsasdadsasdasdasadsadsads adsadsaad");
}
__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?
Nov 16 '05 #1
1 1639
Humber Consumer <co***********@yahoo.com> wrote:
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?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: harry | last post by:
Hi all I am putting a code snippet #include "stdio.h" #include "conio.h" struct base{ int i; char c; };
18
by: Dev | last post by:
I'm working with some IBM sponsored C APIs to interface with a corporate legacy system, and it seems that I'm getting some stack corruption after any API call. I believe the APIs were designed...
14
by: Peter Schmitz | last post by:
Hi, I'm currently developing an application that includes an implementation of the well-known Boyer- Moore algorithm. For this, I use the implementation of Thierry Lecrq from...
7
by: ifoundgoldbug | last post by:
Ok here is a short description of what i am doing. I need to program a dll for use by another program. the dll compiles fine but when i call it from another program i get a stack corruption of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.