Contents of /trunk/xorg-server/patches/xorg-server-1.3.0.0-use-composite-for-unequal-depths.patch
Parent Directory | Revision Log
Revision 394 -
(show annotations)
(download)
Mon Nov 5 23:12:22 2007 UTC (16 years, 10 months ago) by niro
File size: 3528 byte(s)
Mon Nov 5 23:12:22 2007 UTC (16 years, 10 months ago) by niro
File size: 3528 byte(s)
-security update, fixes FrSIRT/ADV-2007-3098
1 | Gentoo bug #191964 |
2 | freedesktop.org bug #7447 attachment #11368 |
3 | Fixed in 1.4 and newer |
4 | |
5 | diff --git a/composite/compalloc.c b/composite/compalloc.c |
6 | index f555411..006e808 100644 |
7 | --- a/composite/compalloc.c |
8 | +++ b/composite/compalloc.c |
9 | @@ -461,7 +461,6 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h) |
10 | ScreenPtr pScreen = pWin->drawable.pScreen; |
11 | WindowPtr pParent = pWin->parent; |
12 | PixmapPtr pPixmap; |
13 | - GCPtr pGC; |
14 | |
15 | pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth); |
16 | |
17 | @@ -471,25 +470,63 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h) |
18 | pPixmap->screen_x = x; |
19 | pPixmap->screen_y = y; |
20 | |
21 | - pGC = GetScratchGC (pWin->drawable.depth, pScreen); |
22 | - |
23 | - /* |
24 | - * Copy bits from the parent into the new pixmap so that it will |
25 | - * have "reasonable" contents in case for background None areas. |
26 | - */ |
27 | - if (pGC) |
28 | + if (pParent->drawable.depth == pWin->drawable.depth) |
29 | { |
30 | - XID val = IncludeInferiors; |
31 | + GCPtr pGC = GetScratchGC (pWin->drawable.depth, pScreen); |
32 | |
33 | - ValidateGC(&pPixmap->drawable, pGC); |
34 | - dixChangeGC (serverClient, pGC, GCSubwindowMode, &val, NULL); |
35 | - (*pGC->ops->CopyArea) (&pParent->drawable, |
36 | - &pPixmap->drawable, |
37 | - pGC, |
38 | - x - pParent->drawable.x, |
39 | - y - pParent->drawable.y, |
40 | - w, h, 0, 0); |
41 | - FreeScratchGC (pGC); |
42 | + /* |
43 | + * Copy bits from the parent into the new pixmap so that it will |
44 | + * have "reasonable" contents in case for background None areas. |
45 | + */ |
46 | + if (pGC) |
47 | + { |
48 | + XID val = IncludeInferiors; |
49 | + |
50 | + ValidateGC(&pPixmap->drawable, pGC); |
51 | + dixChangeGC (serverClient, pGC, GCSubwindowMode, &val, NULL); |
52 | + (*pGC->ops->CopyArea) (&pParent->drawable, |
53 | + &pPixmap->drawable, |
54 | + pGC, |
55 | + x - pParent->drawable.x, |
56 | + y - pParent->drawable.y, |
57 | + w, h, 0, 0); |
58 | + FreeScratchGC (pGC); |
59 | + } |
60 | + } |
61 | + else |
62 | + { |
63 | + PictFormatPtr pSrcFormat = compWindowFormat (pParent); |
64 | + PictFormatPtr pDstFormat = compWindowFormat (pWin); |
65 | + XID inferiors = IncludeInferiors; |
66 | + int error; |
67 | + |
68 | + PicturePtr pSrcPicture = CreatePicture (None, |
69 | + &pParent->drawable, |
70 | + pSrcFormat, |
71 | + CPSubwindowMode, |
72 | + &inferiors, |
73 | + serverClient, &error); |
74 | + |
75 | + PicturePtr pDstPicture = CreatePicture (None, |
76 | + &pPixmap->drawable, |
77 | + pDstFormat, |
78 | + 0, 0, |
79 | + serverClient, &error); |
80 | + |
81 | + if (pSrcPicture && pDstPicture) |
82 | + { |
83 | + CompositePicture (PictOpSrc, |
84 | + pSrcPicture, |
85 | + NULL, |
86 | + pDstPicture, |
87 | + x - pParent->drawable.x, |
88 | + y - pParent->drawable.y, |
89 | + 0, 0, 0, 0, w, h); |
90 | + } |
91 | + if (pSrcPicture) |
92 | + FreePicture (pSrcPicture, 0); |
93 | + if (pDstPicture) |
94 | + FreePicture (pDstPicture, 0); |
95 | } |
96 | return pPixmap; |
97 | } |
98 | diff --git a/composite/compint.h b/composite/compint.h |
99 | index 38b1777..f69595c 100644 |
100 | --- a/composite/compint.h |
101 | +++ b/composite/compint.h |
102 | @@ -237,6 +237,9 @@ compCheckTree (ScreenPtr pScreen); |
103 | #define compCheckTree(s) |
104 | #endif |
105 | |
106 | +PictFormatPtr |
107 | +compWindowFormat (WindowPtr pWin); |
108 | + |
109 | void |
110 | compSetPixmap (WindowPtr pWin, PixmapPtr pPixmap); |
111 | |
112 | diff --git a/composite/compwindow.c b/composite/compwindow.c |
113 | index a4c4e6f..bfd2946 100644 |
114 | --- a/composite/compwindow.c |
115 | +++ b/composite/compwindow.c |
116 | @@ -685,7 +685,7 @@ compGetWindowVisual (WindowPtr pWin) |
117 | return 0; |
118 | } |
119 | |
120 | -static PictFormatPtr |
121 | +PictFormatPtr |
122 | compWindowFormat (WindowPtr pWin) |
123 | { |
124 | ScreenPtr pScreen = pWin->drawable.pScreen; |