]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/xserver.git/blob - debian/patches/230_randr_catch_two_more_potential_unset_rrScrPriv_uses.patch
Merge branch 'ubuntu'
[glsdk/xserver.git] / debian / patches / 230_randr_catch_two_more_potential_unset_rrScrPriv_uses.patch
1 From 855003c333a0ead1db912695bc9705ef2b3144b4 Mon Sep 17 00:00:00 2001
2 From: Keith Packard <keithp@keithp.com>
3 Date: Thu, 21 Jun 2012 18:45:18 -0700
4 Subject: [PATCH] randr: Catch two more potential unset rrScrPriv uses
6 Ricardo Salveti <ricardo.salveti@linaro.org> found one place where the
7 randr code could use the randr screen private data without checking
8 for null first. This happens when the X server is running with
9 multiple screens, some of which are randr enabled and some of which
10 are not. Applications making protocol requests to the non-randr
11 screens can cause segfaults where the server touches the unset private
12 structure.
14 I audited the code and found two more possible problem spots; the
15 trick to auditing for this issue was to look for functions not taking
16 a RandR data structure and where there was no null screen private
17 check above them in the call graph.
19 Signed-off-by: Keith Packard <keithp@keithp.com>
20 ---
21  randr/rroutput.c |    3 ++-
22  randr/rrscreen.c |    3 +++
23  2 files changed, 5 insertions(+), 1 deletion(-)
25 diff --git a/randr/rroutput.c b/randr/rroutput.c
26 index 091e06b..fbd0e32 100644
27 --- a/randr/rroutput.c
28 +++ b/randr/rroutput.c
29 @@ -546,7 +546,8 @@ ProcRRSetOutputPrimary(ClientPtr client)
30      }
31  
32      pScrPriv = rrGetScrPriv(pWin->drawable.pScreen);
33 -    RRSetPrimaryOutput(pWin->drawable.pScreen, pScrPriv, output);
34 +    if (pScrPriv)
35 +        RRSetPrimaryOutput(pWin->drawable.pScreen, pScrPriv, output);
36  
37      return Success;
38  }
39 diff --git a/randr/rrscreen.c b/randr/rrscreen.c
40 index f570afa..55110e0 100644
41 --- a/randr/rrscreen.c
42 +++ b/randr/rrscreen.c
43 @@ -261,6 +261,9 @@
44  
45      pScreen = pWin->drawable.pScreen;
46      pScrPriv = rrGetScrPriv(pScreen);
47 +    if (!pScrPriv)
48 +        return BadMatch;
49 +
50      if (stuff->width < pScrPriv->minWidth || pScrPriv->maxWidth < stuff->width)
51      {
52         client->errorValue = stuff->width;