mudflap problem

Frank Ch. Eigler fche@redhat.com
Fri Jan 28 19:58:00 GMT 2005


Hi -


[adding cc: gcc mailing list]

On Fri, Jan 28, 2005 at 01:31:59PM -0500, Chris Scott wrote:
> We've been doing some testing with mudflap. For some reason, mudflap 
> does not detect an overflow here, but the sourceforge bounds checker does:
> 
> int a[1024];
> int b[1024];
> 
> [...]
>        int *i;
>        for (i = &b[0]  ; i < &a[1024] ; i++) {
>              *i = 0;
> [...]
> How come mudflap does not catch this [when sourceforge bounds checker
> does]?

That is because mudflap works differently.  It only checks that each
individual pointer dereference points to a valid object: which for
each value of i in this particular case, it does.  It does not
track the fact that i was originally assigned from &b[0].

A straightforward improvement to mudflap would be to emit padding
between adjacent static (or even auto) objects, and mark those
regions as unaccessible.  Then such simple iteration patterns would
be caught.


- FChE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20050128/1fb69b90/attachment.sig>


More information about the Gcc mailing list