Created attachment 65279 [details] Workaround - Patch against Ubuntu 12.04 source (7.6) This is https://bugs.launchpad.net/ubuntu/+source/x11-utils/+bug/1028274 and https://bugzilla.redhat.com/show_bug.cgi?id=808561 [Impact] xwininfo segfaults if called with an out-of-range screen number. [Test Case] 1. xwininfo -root -display :0.0 2. xwininfo -root -display :0.1 Actual Behavior: * First command passes * Second command segfaults Expected Behavior: * First command passes * Second command returns an error message without segfaulting --------------- On Ubuntu 8.04 this error message used to be "cannot open display :0.1". The problem could lie in libxcb (I'm no expert) xcb_connection_has_error() no longer returning true in the -display :0.1 case, but I've attached a patch for xwininfo anyway (sorry about the downstream format etc, not ready to jump into git). My lingering concern is over how many other bits of code use libxcb in this way, and may have had their assumptions broken. I.e. is the "right" place to fix this problem longer term in libxcb?
With current master (5037f79e8f6a36d3c524a2dd8150cf96c31b7106): Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000001 0x00000001000016e1 in Select_Window (dpy=0x10081bc00, screen=0x100822bd4, descend=1) at dsimple.c:180 180 if (grab_reply->status != XCB_GRAB_STATUS_SUCCESS) (gdb) bt #0 0x00000001000016e1 in Select_Window (dpy=0x10081bc00, screen=0x100822bd4, descend=1) at dsimple.c:180 #1 0x00000001000031bf in main (argc=4, argv=0x7fff5fbff950) at xwininfo.c:573 Current language: auto; currently minimal (gdb) print grab_reply $1 = (xcb_grab_pointer_reply_t *) 0x0 (gdb)
Took the question of where to check, libxcb or callers like xwininfo, to the xcb mailing list for discussion: http://lists.freedesktop.org/archives/xcb/2012-August/007840.html
Created attachment 66113 [details] [review] 0001-Return-connection-failure-if-display-string-specifie.patch Here's a patch for libxcb based on alanc's libxcb patch, but it introduces a new error code to allow callers to tell the difference between the two errors.
Created attachment 66114 [details] [review] libxcb patch, introducing XCB_CONN_CLOSED_INVALID_SCREEN Addresses a couple issues in the original patch
Created attachment 66115 [details] [review] Yet another revision of libxcb patch Merged my fixes with Jeremy's improvements to the previous libxcb patches. Yay for remote pair programming via bugzilla/irc! (Sorry for the rapid fire noise for everyone else.)
Fixes pushed to git master for next releases: To ssh://git.freedesktop.org/git/xorg/app/xwininfo 53564df..aedc2ec master -> master To ssh://git.freedesktop.org/git/xcb/libxcb ed93a6a..ff53285 master -> master
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.