/[gentoo-x86]/x11-base/xorg-server/files/1.1.1-dbe-render.diff
Gentoo

Contents of /x11-base/xorg-server/files/1.1.1-dbe-render.diff

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sun Sep 9 10:34:45 2007 UTC (7 years ago) by dberkholz
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
FILE REMOVED
Drop 1.1, everyone's stable on 1.2 or 1.3.
(Portage version: 2.1.3.8)

1 diff --git a/dbe/dbe.c b/dbe/dbe.c
2 index 5b43dd1..6a2ed6a 100644
3 --- a/dbe/dbe.c
4 +++ b/dbe/dbe.c
5 @@ -39,6 +39,11 @@
6 #endif
7
8 #include <string.h>
9 +#if HAVE_STDINT_T
10 +#include <stdint.h>
11 +#elif !defined(UINT32_MAX)
12 +#define UINT32_MAX 0xffffffffU
13 +#endif
14
15 #include <X11/X.h>
16 #include <X11/Xproto.h>
17 @@ -713,11 +718,14 @@ ProcDbeSwapBuffers(ClientPtr client)
18 return(Success);
19 }
20
21 + if (nStuff > UINT32_MAX / sizeof(DbeSwapInfoRec))
22 + return BadAlloc;
23 +
24 /* Get to the swap info appended to the end of the request. */
25 dbeSwapInfo = (xDbeSwapInfo *)&stuff[1];
26
27 /* Allocate array to record swap information. */
28 - swapInfo = (DbeSwapInfoPtr)ALLOCATE_LOCAL(nStuff * sizeof(DbeSwapInfoRec));
29 + swapInfo = (DbeSwapInfoPtr)Xalloc(nStuff * sizeof(DbeSwapInfoRec));
30 if (swapInfo == NULL)
31 {
32 return(BadAlloc);
33 @@ -732,14 +740,14 @@ ProcDbeSwapBuffers(ClientPtr client)
34 if (!(pWin = SecurityLookupWindow(dbeSwapInfo[i].window, client,
35 SecurityWriteAccess)))
36 {
37 - DEALLOCATE_LOCAL(swapInfo);
38 + Xfree(swapInfo);
39 return(BadWindow);
40 }
41
42 /* Each window must be double-buffered - BadMatch. */
43 if (DBE_WINDOW_PRIV(pWin) == NULL)
44 {
45 - DEALLOCATE_LOCAL(swapInfo);
46 + Xfree(swapInfo);
47 return(BadMatch);
48 }
49
50 @@ -748,7 +756,7 @@ ProcDbeSwapBuffers(ClientPtr client)
51 {
52 if (dbeSwapInfo[i].window == dbeSwapInfo[j].window)
53 {
54 - DEALLOCATE_LOCAL(swapInfo);
55 + Xfree(swapInfo);
56 return(BadMatch);
57 }
58 }
59 @@ -759,7 +767,7 @@ ProcDbeSwapBuffers(ClientPtr client)
60 (dbeSwapInfo[i].swapAction != XdbeUntouched ) &&
61 (dbeSwapInfo[i].swapAction != XdbeCopied ))
62 {
63 - DEALLOCATE_LOCAL(swapInfo);
64 + Xfree(swapInfo);
65 return(BadValue);
66 }
67
68 @@ -789,12 +797,12 @@ ProcDbeSwapBuffers(ClientPtr client)
69 error = (*pDbeScreenPriv->SwapBuffers)(client, &nStuff, swapInfo);
70 if (error != Success)
71 {
72 - DEALLOCATE_LOCAL(swapInfo);
73 + Xfree(swapInfo);
74 return(error);
75 }
76 }
77
78 - DEALLOCATE_LOCAL(swapInfo);
79 + Xfree(swapInfo);
80 return(Success);
81
82 } /* ProcDbeSwapBuffers() */
83 @@ -876,10 +884,12 @@ ProcDbeGetVisualInfo(ClientPtr client)
84
85 REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq);
86
87 + if (stuff->n > UINT32_MAX / sizeof(DrawablePtr))
88 + return BadAlloc;
89 /* Make sure any specified drawables are valid. */
90 if (stuff->n != 0)
91 {
92 - if (!(pDrawables = (DrawablePtr *)ALLOCATE_LOCAL(stuff->n *
93 + if (!(pDrawables = (DrawablePtr *)Xalloc(stuff->n *
94 sizeof(DrawablePtr))))
95 {
96 return(BadAlloc);
97 @@ -892,7 +902,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
98 if (!(pDrawables[i] = (DrawablePtr)SecurityLookupDrawable(
99 drawables[i], client, SecurityReadAccess)))
100 {
101 - DEALLOCATE_LOCAL(pDrawables);
102 + Xfree(pDrawables);
103 return(BadDrawable);
104 }
105 }
106 @@ -904,7 +914,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
107 {
108 if (pDrawables)
109 {
110 - DEALLOCATE_LOCAL(pDrawables);
111 + Xfree(pDrawables);
112 }
113
114 return(BadAlloc);
115 @@ -931,7 +941,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
116 /* Free pDrawables if we needed to allocate it above. */
117 if (pDrawables)
118 {
119 - DEALLOCATE_LOCAL(pDrawables);
120 + Xfree(pDrawables);
121 }
122
123 return(BadAlloc);
124 @@ -1012,7 +1022,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
125
126 if (pDrawables)
127 {
128 - DEALLOCATE_LOCAL(pDrawables);
129 + Xfree(pDrawables);
130 }
131
132 return(client->noClientException);
133 diff --git a/render/render.c b/render/render.c
134 index e4d8d6b..55f360a 100644
135 --- a/render/render.c
136 +++ b/render/render.c
137 @@ -47,6 +47,12 @@
138 #include <X11/Xfuncproto.h>
139 #include "cursorstr.h"
140
141 +#if HAVE_STDINT_H
142 +#include <stdint.h>
143 +#elif !defined(UINT32_MAX)
144 +#define UINT32_MAX 0xffffffffU
145 +#endif
146 +
147 static int ProcRenderQueryVersion (ClientPtr pClient);
148 static int ProcRenderQueryPictFormats (ClientPtr pClient);
149 static int ProcRenderQueryPictIndexValues (ClientPtr pClient);
150 @@ -1103,11 +1109,14 @@ ProcRenderAddGlyphs (ClientPtr client)
151 }
152
153 nglyphs = stuff->nglyphs;
154 + if (nglyphs > UINT32_MAX / sizeof(GlyphNewRec))
155 + return BadAlloc;
156 +
157 if (nglyphs <= NLOCALGLYPH)
158 glyphsBase = glyphsLocal;
159 else
160 {
161 - glyphsBase = (GlyphNewPtr) ALLOCATE_LOCAL (nglyphs * sizeof (GlyphNewRec));
162 + glyphsBase = (GlyphNewPtr) Xalloc (nglyphs * sizeof (GlyphNewRec));
163 if (!glyphsBase)
164 return BadAlloc;
165 }
166 @@ -1164,7 +1173,7 @@ ProcRenderAddGlyphs (ClientPtr client)
167 }
168
169 if (glyphsBase != glyphsLocal)
170 - DEALLOCATE_LOCAL (glyphsBase);
171 + Xfree (glyphsBase);
172 return client->noClientException;
173 bail:
174 while (glyphs != glyphsBase)
175 @@ -1173,7 +1182,7 @@ bail:
176 xfree (glyphs->glyph);
177 }
178 if (glyphsBase != glyphsLocal)
179 - DEALLOCATE_LOCAL (glyphsBase);
180 + Xfree (glyphsBase);
181 return err;
182 }
183

  ViewVC Help
Powered by ViewVC 1.1.20