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

« back to all changes in this revision

Viewing changes to debian/patches/100-xwininfo-bad-screen.patch

  • Committer: Package Import Robot
  • Author(s): Bryce Harrington
  • Date: 2012-08-06 10:12:11 UTC
  • Revision ID: package-import@ubuntu.com-20120806101211-1o5w6i2e2mfi07ky
Tags: 7.6+4ubuntu0.1
Add 100-xwininfo-bad-screen.patch: Fix wininfo segfault when called
with out-of-range display number.
(LP: #1028274)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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++)