Jan 15, 2009

You are given the source to an application which is crashing when run. After running it 10 times in a debugger, you find it never crashes in the same

You are given the source to an application which is crashing when run. After running it 10 times in a debugger, you find it never crashes in the same place. The application is single threaded, and uses only the C standard library. What programming errors could be causing this crash? How would you test each one?

Possible problem: Memory overwrite.
Use memory profiling tool to find it, like insure++ or purify etc
It also depends on the application and the way it is running. If you run the whole application and not particular event then it may cause the problem as there may be more than one module interacting.
This might be because of memory leaks .
This might be either because of heap overflow or corruption of data on the stack .
For detecting these issues , we can either use Purify, valgrind and other dynamic memory watch tools.
If there is memory leak or overwrite, it should crash at the same place all the time. I think there is a random number/some variable which is deciding the behavior of the program/crash site.

No comments:

Post a Comment