[PATCH:libXdmcp 3/4] Ensure ARRAYofARRAY8 pointers are initialized to NULL

Alan Coopersmith alan.coopersmith at oracle.com
Sat Sep 28 10:23:13 PDT 2013


On 09/27/13 10:22 PM, Mouse wrote:
>> Use calloc for the array of pointers to ensure pointers are cleared
>> out so we don't try to free garbage if XdmcpDisposeARRAYofARRAY8 is
>> called before the caller sets them to valid pointers.
>
> C does not promise that all-bits-0 (what calloc produces) gives nil
> pointers (what you need here).  Has X.org given up on portability to
> systems where all-bits-0 is not a nil pointer?  If not, this is a nasty
> bug waiting to happen.

Yes.   There'd already be a lot of bugs where we fail because we assume
calloc initializes pointers to NULL.

Do you know of any such systems X was ever ported to?  Of the ones listed on
http://c-faq.com/null/machexamp.html, Cray is the closest to anything I've
heard of X being ported to, and I'm not sure which model it was, but it was
broken since at least X11R6.

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the xorg-devel mailing list