|
From: Bosso C. <C....@da...> - 2008-05-16 14:28:02
|
Thank you very much for the answer. Therefore, if I understand, Valgrind can check the boundary of dynamic memory because it's allocated at run-time and Memcheck/CPU Emulator can manage it, but can't check static array because it's allocated at compile time and the CPU emulator can't know it's size. It's right ? -----Messaggio originale----- Da: val...@li... [mailto:val...@li...] Per conto di dizzy Inviato: venerdì 16 maggio 2008 14:58 A: val...@li... Oggetto: Re: [Valgrind-users] Valgrind and Static Array On Friday 16 May 2008 15:08:50 Bosso Claudio wrote: > Hi > > I have to write a simple dissertation about Valgrind and I have read in > the faq that it doesn't do bounds checking on static or stack arrays > because is not possible in a reasonable way that fits with how Memcheck > works. > > But why is not possible ? Somebody can explain what thwart the check ? Because you need language/compiler support for that. How do you know from a CPU emulator perspective (what valgrind is) what is an array on the stack and what size it was suposed to have? How do you know from that perspective that you are overflowing the array (in cases where the memory written by the overflow is valid, it belongs to another stack variable)? It probably can be done if you use some kind of valgrind macros in your code, to give valgrind the info it does not have (like this is an array of char of this size). -- Mihai RUSU Email: di...@ro... "Linux is obsolete" -- AST ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Valgrind-users mailing list Val...@li... https://lists.sourceforge.net/lists/listinfo/valgrind-users |