OMG, I find that I did not reply to mailing list. So here is my replies to
those how kindle replied me ;)
-----------------------------------------------------------------------
1- Reply to Bart
-----------------------------------------------------------------------
Thanks, but it says it is a static tool, therefore cannot work for dynamic
arrays or even for input argument of a function. My problem is that static
tools generate too much errors and dynamic tools like valgrind may not find
a bug if the test have poor coverage, which almost always is the case. So I
need something in between.
-----------------------------------------------------------------------
2- Reply to Bard
-----------------------------------------------------------------------
Ideally, I am thinking of a function, let say RUNTIME_SIZEOF(x) that gives
the size of object x at runtime, no matter if it is a local or global or
heap variable. Having such a function in valgrind library, then one can
simply write a wrapper for every function like strcpy:

*#include <stdio.h>*
* *

*#include "valgrind.h"*
* *

*char *I_WRAP_SONAME_FNNAME_ZU(???,**strcpy)(char *buff1, char *buff2)*
* *

*{*
* *

*       char * result;*
* *

*       OrigFn fn;*
* *

*       VALGRIND_GET_ORIG_FN(fn);*

*       if(RUNTIME_SIZEOF(buff1) < RUNTIME_SIZEOF(buff2))*

*       {*

*               printf("SOME ERROR REPORT");
*

*       }
*
* *

*       CALL_FN_W_WW(result, buff1, buff2); *
*       return result;
}*
-----------------------------------------------------------------------
3- Reply to Philippe:
-----------------------------------------------------------------------
Thanks Philippe,
I know that can be an interesting extension. I also hope that to Valgrind
developers doing so can be easy. For dynamically allocated structs, I just
expected a tool that can detect if the size of a hole block/struct is large
enough, not specifically one of its static array fields. I think that work
well in many cases. However, there should be a way to implement such a
runtime type checking as well: it will be easy in the case of using new
operator in C++. With malloc as well the desired tool can guess the type of
block by observing the type of pointers in which the address of the block
is stored after malloc.

But the question here is how we can ask valgrind developers to kindly
implement such an extension. It will be very hard to me to do so and I hope
no one force me to do that!!!
-----------------------------------------------------------------------
Thanks all
------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to