Page 1 of 1

[Programming] Tools to detect buffer overflow

Posted: Sun Oct 19, 2014 6:34 pm
by mickagame
I'm working on my genesis emulator and i start to implement the sound part.
Since this part is terminated i have randomly crash and i'm sure is because buffer overflow occuring.
Does anyone know if exist tools to detect where there is data writing outside the alloctaed area?

I'm working with code::block and gcc compiler.

Thanks for your help !

Posted: Sun Oct 19, 2014 6:38 pm
by MintyTheCat
Hi,

off the top of my head:

Valgrind

Posted: Sun Oct 19, 2014 7:25 pm
by mickagame
I work on windows.
But your link help me to find windows substitute : drmemory

I will try to run my program with this tool :-)

Thanks

Posted: Sun Oct 19, 2014 7:38 pm
by MintyTheCat
I have no Windows programming experience whatsoever.

Electric-Fence if it is on Windows. If you use some kind of UNIX Shell such as Cygwin then you could use Valgrind. I work on the Command-Line most so those tools are open to me under most platforms.

Cheers,

Minty.

Posted: Sun Oct 19, 2014 8:36 pm
by mickagame
My emulator is cross-plateform so it wouldn't be difficult to developp it under linux.
I will try it because i'm curious t osee how it run on linux plateform.

=> Dr Memory help me to find the function where i was doing buffer overflow.
Now all is perfect ;-)

Posted: Sun Oct 19, 2014 8:46 pm
by MintyTheCat
mickagame wrote:My emulator is cross-plateform so it wouldn't be difficult to developp it under linux.
I will try it because i'm curious t osee how it run on linux plateform.

=> Dr Memory help me to find the function where i was doing buffer overflow.
Now all is perfect ;-)
Another useful one is STrace to really get into the meat of your Function calls.
UNIX also has plenty of Tools to debug Shared-Memory Segments and such - I feel sorry for anyone who has to develop for Windows :D

Posted: Mon Oct 20, 2014 8:26 am
by mickagame
Next week i will install linux and code::block and i will try it :-). But is very useful tools without that i would past somme hours to find this programming error!

Posted: Mon Oct 20, 2014 8:58 am
by MintyTheCat
UNIX generally has most it not all of the Tools. Historically many of the Tool and OS advancements arrived on UNIX first. The other thing is that good Tools are not lost between OSes and OS version so the same Tool that you used twenty years ago will still be there.

I had a guy working with me years ago who had not used VI the Editor for 17 years and he was straight back into using it without any issues as things worked and his knowledge was still valid.

UNIX respects knowledge and you will find that anything you learn can be relied up on.

I suppose that's why I love UNIX :)