~ubuntu-branches/ubuntu/precise/x11-utils/precise-proposed

13 by Bryce Harrington
Add 100-xwininfo-bad-screen.patch: Fix wininfo segfault when called
1
Index: x11-utils-7.6+4/xwininfo/dsimple.c
2
===================================================================
3
--- x11-utils-7.6+4.orig/xwininfo/dsimple.c	2011-10-21 16:00:11.000000000 +1000
4
+++ x11-utils-7.6+4/xwininfo/dsimple.c	2012-07-24 16:20:47.053575611 +1000
5
@@ -120,6 +120,12 @@
6
     if (screen) {
7
 	/* find our screen */
8
 	const xcb_setup_t *setup = xcb_get_setup(*dpy);
9
+	int screen_count = xcb_setup_roots_length(setup);
10
+	if (screen_count <= screen_number)
11
+	{
12
+		Fatal_Error ("unable to access screen %d, max is %d",
13
+				screen_number, screen_count-1 );
14
+	}
15
 	xcb_screen_iterator_t screen_iter = xcb_setup_roots_iterator(setup);
16
 
17
 	for (i = 0; i < screen_number; i++)