[Xcb] [PATCH libXau] Avoid heap corruption when calling XauFileName from multiple threads.

Mark Kettenis mark.kettenis at xs4all.nl
Mon Mar 28 11:14:08 PDT 2011

> Date: Mon, 28 Mar 2011 10:21:06 -0700
> From: Alan Coopersmith <alan.coopersmith at oracle.com>
> > This commit fixes only the heap corruption and sporadic crashes. It's
> > still possible that XauFileName returns a badly formed filename string
> > if called from multiple threads. For example, changing contents of
> > HOME environment variable could make the returned string to be
> > malformed. However, there shouldn't be crashes.
> Perhaps we just need to define a new function to do this, that doesn't
> use a static global variable of any sort, and declare that multi-threaded
> code needs to use it.

That does make more sense than adding hacks to limit the potential
damage.  The current interface simply is inherently thread-unsafe.

More information about the xorg-devel mailing list