checked sources of xorg-server 1.7.0 with static code analysis tool cppcheck

Florian Mickler florian at mickler.org
Sun Oct 4 14:52:32 PDT 2009


On Sat, 3 Oct 2009 09:11:35 -0400 (EDT)
Thomas Dickey <dickey at his.com> wrote:

> On Sat, 3 Oct 2009, Michel D_nzer wrote:
> 
> > On Sat, 2009-10-03 at 08:43 -0400, Thomas Dickey wrote:
> >> On Sat, 3 Oct 2009, Michel Dnzer wrote:
> >>
> >>> What purpose is that? If these functions were actually called with a
> >>> NULL PixmapPtr, surely the current code would have crashed with a
> >>> segmentation fault.
> >>
> >> I suppose that if you prefer the server to crash rather than check error
> >> conditions, there's no point in the change.
> >
> > I'd expect ModifyPixmapHeader getting called with a NULL PixmapPtr to
> > always be a bug in the caller. I'd rather catch and fix that than cover
> > it up. Maybe I'm missing something.
> 
> The called function is one point to check,
> the calling functions are potentially many.
> 
> Duplicating checks around random points is something that we attempt to
> train people not to do.
> 
> awai
> 

[i have not read the source nor the patch] 

sometimes, it is better to assert that a function is called with the
right parameters. 
especially if you could not handle that error at that level in a sane
way.

-- 
A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?  
>> A: Top-posting.  
>>> Q: What is the most annoying thing in e-mail?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://lists.x.org/archives/xorg-devel/attachments/20091004/3d63ff31/attachment.pgp 


More information about the xorg-devel mailing list