C++ MFC

Moderators: Lundin
Number of threads: 3337
Number of posts: 9005

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
The ways for an application to crash Posted by rageshctech on 9 Jan 2009 at 4:20 AM
Hi all,

I'm going to create an application that emulates different types of crashes...
So, can you guys help me by listing all known ways in which an application can crash?
For example,
The code:
char *p = 0; // Null pointer.
char x = 0;
*p = x;

Is an illegal write, which shows the error:

and the application will be closed...
Please help!!!
Report
Re: The ways for an application to crash Posted by Jonathan on 9 Jan 2009 at 5:53 AM
Hi,

Some other fun ways might include stack overflow (write an infinitely recursive function), consuming all available memory (infinite loop that mallocs), dereferencing a pointer that's uninitialized and copying over the return address on the stack. You can probably trigger an NX failure by trying to use an address you've malloc'd as a function pointer too, if your CPU supports it...

Yes, I have done all of these by accident at some point.

Jonathan
###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");
Report
Re: The ways for an application to crash Posted by Lundin on 9 Jan 2009 at 8:42 AM
There are almost as many ways as there are functions available to the programmer... Every program bug has the potential to cause a crash.

- Accessing uninitalized memory / wrong addresses. Null pointers, array bugs, pointer bugs etc.
- Jumping to wrong addresses / using invalid function pointers.
- Out of memory. Stack / global RAM / heap / program memory / HD memory...
- I/O errors. File handling, pipes/IPC, hardware I/O, registry I/O etc etc.
- Accessing corrupt hardware.
- Divide by zero.
- Deadlock bugs. Waiting for resources that are never released. Could be both hardware and software resources.
- Semaphore/mutex bugs. Multi-threaded programs that don't protect shared variables.
- Crashing the OS through wrong use of API functions.
- Doing dumb things in assembler, such as not stacking CPU registers before using them.
- And on and on and on...
Report
Re: The ways for an application to crash Posted by rageshctech on 13 Jan 2009 at 2:28 AM
Thank you very much for listing those...



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.