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

Alan Coopersmith alan.coopersmith at oracle.com
Mon Mar 28 10:21:06 PDT 2011


On 03/28/11 03:45 AM, Rami Ylimäki wrote:
> An XCB test application will always crash because of heap corruption
> if it's running xcb_connect/xcb_disconnect continuously from multiple
> threads. The problem can also happen in real applications if
> XOpenDisplay and xcb_connect are called simultaneously.

Xau has been known to be non-thread-safe for a very long time --
https://bugs.freedesktop.org/show_bug.cgi?id=7588 is a copy of a report
from the original X Consortium bug database that never got fixed (and
seems to be in this same code path).

> 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.

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the Xcb mailing list