1 From d303d79450436a1ef04252c2a7e36870c2506f38 Mon Sep 17 00:00:00 2001
2 From: Adam Jackson <ajax@redhat.com>
3 Date: Mon, 10 Nov 2014 12:13:48 -0500
4 Subject: [PATCH 32/33] glx: Pass remaining request length into ->varsize (v2)
7 v2: Handle more multiplies in indirect_reqsize.c (Julien Cristau)
9 Reviewed-by: Julien Cristau <jcristau@debian.org>
10 Reviewed-by: Michal Srb <msrb@suse.com>
11 Reviewed-by: Andy Ritger <aritger@nvidia.com>
12 Signed-off-by: Adam Jackson <ajax@redhat.com>
13 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
16 glx/glxserver.h | 2 +-
17 glx/indirect_reqsize.c | 142 +++++++++++++++++++------------------
18 glx/indirect_reqsize.h | 181 +++++++++++++++++++++++++++++-------------------
19 glx/rensize.c | 27 +++++---
20 5 files changed, 205 insertions(+), 154 deletions(-)
24 @@ -2057,7 +2057,8 @@ __glXDisp_Render(__GLXclientState * cl,
26 /* variable size command */
27 extra = (*entry.varsize) (pc + __GLX_RENDER_HDR_SIZE,
30 + left - __GLX_RENDER_HDR_SIZE);
34 @@ -2134,6 +2135,7 @@ __glXDisp_RenderLarge(__GLXclientState *
35 if (cl->largeCmdRequestsSoFar == 0) {
36 __GLXrenderSizeData entry;
38 + int left = (req->length << 2) - sz_xGLXRenderLargeReq;
42 @@ -2174,7 +2176,8 @@ __glXDisp_RenderLarge(__GLXclientState *
43 ** will be in the 1st request, so it's okay to do this.
45 extra = (*entry.varsize) (pc + __GLX_RENDER_LARGE_HDR_SIZE,
48 + left - __GLX_RENDER_LARGE_HDR_SIZE);
54 @@ -179,7 +179,7 @@ typedef int (*__GLXprocPtr) (__GLXclient
56 * Tables for computing the size of each rendering command.
58 -typedef int (*gl_proto_size_func) (const GLbyte *, Bool);
59 +typedef int (*gl_proto_size_func) (const GLbyte *, Bool, int);
63 --- a/glx/indirect_reqsize.c
64 +++ b/glx/indirect_reqsize.c
66 #include "indirect_size.h"
67 #include "indirect_reqsize.h"
69 -#define __GLX_PAD(x) (((x) + 3) & ~3)
71 #if defined(__CYGWIN__) || defined(__MINGW32__)
75 #define ALIAS2(from,to) \
76 - GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \
77 + GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap, int reqlen ) \
78 __attribute__ ((alias( # to )));
79 #define ALIAS(from,to) ALIAS2( from, __glX ## to ## ReqSize )
81 #define ALIAS(from,to) \
82 - GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \
83 - { return __glX ## to ## ReqSize( pc, swap ); }
84 + GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap, int reqlen ) \
85 + { return __glX ## to ## ReqSize( pc, swap, reqlen ); }
89 -__glXCallListsReqSize(const GLbyte * pc, Bool swap)
90 +__glXCallListsReqSize(const GLbyte * pc, Bool swap, int reqlen)
92 GLsizei n = *(GLsizei *) (pc + 0);
93 GLenum type = *(GLenum *) (pc + 4);
94 @@ -60,11 +58,11 @@ __glXCallListsReqSize(const GLbyte * pc,
97 compsize = __glCallLists_size(type);
98 - return __GLX_PAD((compsize * n));
99 + return safe_pad(safe_mul(compsize, n));
103 -__glXBitmapReqSize(const GLbyte * pc, Bool swap)
104 +__glXBitmapReqSize(const GLbyte * pc, Bool swap, int reqlen)
106 GLint row_length = *(GLint *) (pc + 4);
107 GLint image_height = 0;
108 @@ -88,7 +86,7 @@ __glXBitmapReqSize(const GLbyte * pc, Bo
112 -__glXFogfvReqSize(const GLbyte * pc, Bool swap)
113 +__glXFogfvReqSize(const GLbyte * pc, Bool swap, int reqlen)
115 GLenum pname = *(GLenum *) (pc + 0);
117 @@ -98,11 +96,11 @@ __glXFogfvReqSize(const GLbyte * pc, Boo
120 compsize = __glFogfv_size(pname);
121 - return __GLX_PAD((compsize * 4));
122 + return safe_pad(safe_mul(compsize, 4));
126 -__glXLightfvReqSize(const GLbyte * pc, Bool swap)
127 +__glXLightfvReqSize(const GLbyte * pc, Bool swap, int reqlen)
129 GLenum pname = *(GLenum *) (pc + 4);
131 @@ -112,11 +110,11 @@ __glXLightfvReqSize(const GLbyte * pc, B
134 compsize = __glLightfv_size(pname);
135 - return __GLX_PAD((compsize * 4));
136 + return safe_pad(safe_mul(compsize, 4));
140 -__glXLightModelfvReqSize(const GLbyte * pc, Bool swap)
141 +__glXLightModelfvReqSize(const GLbyte * pc, Bool swap, int reqlen)
143 GLenum pname = *(GLenum *) (pc + 0);
145 @@ -126,11 +124,11 @@ __glXLightModelfvReqSize(const GLbyte *
148 compsize = __glLightModelfv_size(pname);
149 - return __GLX_PAD((compsize * 4));
150 + return safe_pad(safe_mul(compsize, 4));
154 -__glXMaterialfvReqSize(const GLbyte * pc, Bool swap)
155 +__glXMaterialfvReqSize(const GLbyte * pc, Bool swap, int reqlen)
157 GLenum pname = *(GLenum *) (pc + 4);
159 @@ -140,11 +138,11 @@ __glXMaterialfvReqSize(const GLbyte * pc
162 compsize = __glMaterialfv_size(pname);
163 - return __GLX_PAD((compsize * 4));
164 + return safe_pad(safe_mul(compsize, 4));
168 -__glXPolygonStippleReqSize(const GLbyte * pc, Bool swap)
169 +__glXPolygonStippleReqSize(const GLbyte * pc, Bool swap, int reqlen)
171 GLint row_length = *(GLint *) (pc + 4);
172 GLint image_height = 0;
173 @@ -164,7 +162,7 @@ __glXPolygonStippleReqSize(const GLbyte
177 -__glXTexParameterfvReqSize(const GLbyte * pc, Bool swap)
178 +__glXTexParameterfvReqSize(const GLbyte * pc, Bool swap, int reqlen)
180 GLenum pname = *(GLenum *) (pc + 4);
182 @@ -174,11 +172,11 @@ __glXTexParameterfvReqSize(const GLbyte
185 compsize = __glTexParameterfv_size(pname);
186 - return __GLX_PAD((compsize * 4));
187 + return safe_pad(safe_mul(compsize, 4));
191 -__glXTexImage1DReqSize(const GLbyte * pc, Bool swap)
192 +__glXTexImage1DReqSize(const GLbyte * pc, Bool swap, int reqlen)
194 GLint row_length = *(GLint *) (pc + 4);
195 GLint image_height = 0;
196 @@ -206,7 +204,7 @@ __glXTexImage1DReqSize(const GLbyte * pc
200 -__glXTexImage2DReqSize(const GLbyte * pc, Bool swap)
201 +__glXTexImage2DReqSize(const GLbyte * pc, Bool swap, int reqlen)
203 GLint row_length = *(GLint *) (pc + 4);
204 GLint image_height = 0;
205 @@ -236,7 +234,7 @@ __glXTexImage2DReqSize(const GLbyte * pc
209 -__glXTexEnvfvReqSize(const GLbyte * pc, Bool swap)
210 +__glXTexEnvfvReqSize(const GLbyte * pc, Bool swap, int reqlen)
212 GLenum pname = *(GLenum *) (pc + 4);
214 @@ -246,11 +244,11 @@ __glXTexEnvfvReqSize(const GLbyte * pc,
217 compsize = __glTexEnvfv_size(pname);
218 - return __GLX_PAD((compsize * 4));
219 + return safe_pad(safe_mul(compsize, 4));
223 -__glXTexGendvReqSize(const GLbyte * pc, Bool swap)
224 +__glXTexGendvReqSize(const GLbyte * pc, Bool swap, int reqlen)
226 GLenum pname = *(GLenum *) (pc + 4);
228 @@ -260,11 +258,11 @@ __glXTexGendvReqSize(const GLbyte * pc,
231 compsize = __glTexGendv_size(pname);
232 - return __GLX_PAD((compsize * 8));
233 + return safe_pad(safe_mul(compsize, 8));
237 -__glXTexGenfvReqSize(const GLbyte * pc, Bool swap)
238 +__glXTexGenfvReqSize(const GLbyte * pc, Bool swap, int reqlen)
240 GLenum pname = *(GLenum *) (pc + 4);
242 @@ -274,11 +272,11 @@ __glXTexGenfvReqSize(const GLbyte * pc,
245 compsize = __glTexGenfv_size(pname);
246 - return __GLX_PAD((compsize * 4));
247 + return safe_pad(safe_mul(compsize, 4));
251 -__glXPixelMapfvReqSize(const GLbyte * pc, Bool swap)
252 +__glXPixelMapfvReqSize(const GLbyte * pc, Bool swap, int reqlen)
254 GLsizei mapsize = *(GLsizei *) (pc + 4);
256 @@ -286,11 +284,11 @@ __glXPixelMapfvReqSize(const GLbyte * pc
257 mapsize = bswap_32(mapsize);
260 - return __GLX_PAD((mapsize * 4));
261 + return safe_pad(safe_mul(mapsize, 4));
265 -__glXPixelMapusvReqSize(const GLbyte * pc, Bool swap)
266 +__glXPixelMapusvReqSize(const GLbyte * pc, Bool swap, int reqlen)
268 GLsizei mapsize = *(GLsizei *) (pc + 4);
270 @@ -298,11 +296,11 @@ __glXPixelMapusvReqSize(const GLbyte * p
271 mapsize = bswap_32(mapsize);
274 - return __GLX_PAD((mapsize * 2));
275 + return safe_pad(safe_mul(mapsize, 2));
279 -__glXDrawPixelsReqSize(const GLbyte * pc, Bool swap)
280 +__glXDrawPixelsReqSize(const GLbyte * pc, Bool swap, int reqlen)
282 GLint row_length = *(GLint *) (pc + 4);
283 GLint image_height = 0;
284 @@ -330,7 +328,7 @@ __glXDrawPixelsReqSize(const GLbyte * pc
288 -__glXPrioritizeTexturesReqSize(const GLbyte * pc, Bool swap)
289 +__glXPrioritizeTexturesReqSize(const GLbyte * pc, Bool swap, int reqlen)
291 GLsizei n = *(GLsizei *) (pc + 0);
293 @@ -338,11 +336,11 @@ __glXPrioritizeTexturesReqSize(const GLb
297 - return __GLX_PAD((n * 4) + (n * 4));
298 + return safe_pad(safe_add(safe_mul(n, 4), safe_mul(n, 4)));
302 -__glXTexSubImage1DReqSize(const GLbyte * pc, Bool swap)
303 +__glXTexSubImage1DReqSize(const GLbyte * pc, Bool swap, int reqlen)
305 GLint row_length = *(GLint *) (pc + 4);
306 GLint image_height = 0;
307 @@ -370,7 +368,7 @@ __glXTexSubImage1DReqSize(const GLbyte *
311 -__glXTexSubImage2DReqSize(const GLbyte * pc, Bool swap)
312 +__glXTexSubImage2DReqSize(const GLbyte * pc, Bool swap, int reqlen)
314 GLint row_length = *(GLint *) (pc + 4);
315 GLint image_height = 0;
316 @@ -400,7 +398,7 @@ __glXTexSubImage2DReqSize(const GLbyte *
320 -__glXColorTableReqSize(const GLbyte * pc, Bool swap)
321 +__glXColorTableReqSize(const GLbyte * pc, Bool swap, int reqlen)
323 GLint row_length = *(GLint *) (pc + 4);
324 GLint image_height = 0;
325 @@ -428,7 +426,7 @@ __glXColorTableReqSize(const GLbyte * pc
329 -__glXColorTableParameterfvReqSize(const GLbyte * pc, Bool swap)
330 +__glXColorTableParameterfvReqSize(const GLbyte * pc, Bool swap, int reqlen)
332 GLenum pname = *(GLenum *) (pc + 4);
334 @@ -438,11 +436,11 @@ __glXColorTableParameterfvReqSize(const
337 compsize = __glColorTableParameterfv_size(pname);
338 - return __GLX_PAD((compsize * 4));
339 + return safe_pad(safe_mul(compsize, 4));
343 -__glXColorSubTableReqSize(const GLbyte * pc, Bool swap)
344 +__glXColorSubTableReqSize(const GLbyte * pc, Bool swap, int reqlen)
346 GLint row_length = *(GLint *) (pc + 4);
347 GLint image_height = 0;
348 @@ -470,7 +468,7 @@ __glXColorSubTableReqSize(const GLbyte *
352 -__glXConvolutionFilter1DReqSize(const GLbyte * pc, Bool swap)
353 +__glXConvolutionFilter1DReqSize(const GLbyte * pc, Bool swap, int reqlen)
355 GLint row_length = *(GLint *) (pc + 4);
356 GLint image_height = 0;
357 @@ -498,7 +496,7 @@ __glXConvolutionFilter1DReqSize(const GL
361 -__glXConvolutionFilter2DReqSize(const GLbyte * pc, Bool swap)
362 +__glXConvolutionFilter2DReqSize(const GLbyte * pc, Bool swap, int reqlen)
364 GLint row_length = *(GLint *) (pc + 4);
365 GLint image_height = 0;
366 @@ -528,7 +526,7 @@ __glXConvolutionFilter2DReqSize(const GL
370 -__glXConvolutionParameterfvReqSize(const GLbyte * pc, Bool swap)
371 +__glXConvolutionParameterfvReqSize(const GLbyte * pc, Bool swap, int reqlen)
373 GLenum pname = *(GLenum *) (pc + 4);
375 @@ -538,11 +536,11 @@ __glXConvolutionParameterfvReqSize(const
378 compsize = __glConvolutionParameterfv_size(pname);
379 - return __GLX_PAD((compsize * 4));
380 + return safe_pad(safe_mul(compsize, 4));
384 -__glXTexImage3DReqSize(const GLbyte * pc, Bool swap)
385 +__glXTexImage3DReqSize(const GLbyte * pc, Bool swap, int reqlen)
387 GLint row_length = *(GLint *) (pc + 4);
388 GLint image_height = *(GLint *) (pc + 8);
389 @@ -579,7 +577,7 @@ __glXTexImage3DReqSize(const GLbyte * pc
393 -__glXTexSubImage3DReqSize(const GLbyte * pc, Bool swap)
394 +__glXTexSubImage3DReqSize(const GLbyte * pc, Bool swap, int reqlen)
396 GLint row_length = *(GLint *) (pc + 4);
397 GLint image_height = *(GLint *) (pc + 8);
398 @@ -613,7 +611,7 @@ __glXTexSubImage3DReqSize(const GLbyte *
402 -__glXCompressedTexImage1DReqSize(const GLbyte * pc, Bool swap)
403 +__glXCompressedTexImage1DReqSize(const GLbyte * pc, Bool swap, int reqlen)
405 GLsizei imageSize = *(GLsizei *) (pc + 20);
407 @@ -621,11 +619,11 @@ __glXCompressedTexImage1DReqSize(const G
408 imageSize = bswap_32(imageSize);
411 - return __GLX_PAD(imageSize);
412 + return safe_pad(imageSize);
416 -__glXCompressedTexImage2DReqSize(const GLbyte * pc, Bool swap)
417 +__glXCompressedTexImage2DReqSize(const GLbyte * pc, Bool swap, int reqlen)
419 GLsizei imageSize = *(GLsizei *) (pc + 24);
421 @@ -633,11 +631,11 @@ __glXCompressedTexImage2DReqSize(const G
422 imageSize = bswap_32(imageSize);
425 - return __GLX_PAD(imageSize);
426 + return safe_pad(imageSize);
430 -__glXCompressedTexImage3DReqSize(const GLbyte * pc, Bool swap)
431 +__glXCompressedTexImage3DReqSize(const GLbyte * pc, Bool swap, int reqlen)
433 GLsizei imageSize = *(GLsizei *) (pc + 28);
435 @@ -645,11 +643,11 @@ __glXCompressedTexImage3DReqSize(const G
436 imageSize = bswap_32(imageSize);
439 - return __GLX_PAD(imageSize);
440 + return safe_pad(imageSize);
444 -__glXCompressedTexSubImage3DReqSize(const GLbyte * pc, Bool swap)
445 +__glXCompressedTexSubImage3DReqSize(const GLbyte * pc, Bool swap, int reqlen)
447 GLsizei imageSize = *(GLsizei *) (pc + 36);
449 @@ -657,11 +655,11 @@ __glXCompressedTexSubImage3DReqSize(cons
450 imageSize = bswap_32(imageSize);
453 - return __GLX_PAD(imageSize);
454 + return safe_pad(imageSize);
458 -__glXPointParameterfvReqSize(const GLbyte * pc, Bool swap)
459 +__glXPointParameterfvReqSize(const GLbyte * pc, Bool swap, int reqlen)
461 GLenum pname = *(GLenum *) (pc + 0);
463 @@ -671,11 +669,11 @@ __glXPointParameterfvReqSize(const GLbyt
466 compsize = __glPointParameterfv_size(pname);
467 - return __GLX_PAD((compsize * 4));
468 + return safe_pad(safe_mul(compsize, 4));
472 -__glXDrawBuffersReqSize(const GLbyte * pc, Bool swap)
473 +__glXDrawBuffersReqSize(const GLbyte * pc, Bool swap, int reqlen)
475 GLsizei n = *(GLsizei *) (pc + 0);
477 @@ -683,11 +681,11 @@ __glXDrawBuffersReqSize(const GLbyte * p
481 - return __GLX_PAD((n * 4));
482 + return safe_pad(safe_mul(n, 4));
486 -__glXProgramStringARBReqSize(const GLbyte * pc, Bool swap)
487 +__glXProgramStringARBReqSize(const GLbyte * pc, Bool swap, int reqlen)
489 GLsizei len = *(GLsizei *) (pc + 8);
491 @@ -695,11 +693,11 @@ __glXProgramStringARBReqSize(const GLbyt
495 - return __GLX_PAD(len);
496 + return safe_pad(len);
500 -__glXVertexAttribs1dvNVReqSize(const GLbyte * pc, Bool swap)
501 +__glXVertexAttribs1dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen)
503 GLsizei n = *(GLsizei *) (pc + 4);
505 @@ -707,11 +705,11 @@ __glXVertexAttribs1dvNVReqSize(const GLb
509 - return __GLX_PAD((n * 8));
510 + return safe_pad(safe_mul(n, 8));
514 -__glXVertexAttribs2dvNVReqSize(const GLbyte * pc, Bool swap)
515 +__glXVertexAttribs2dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen)
517 GLsizei n = *(GLsizei *) (pc + 4);
519 @@ -719,11 +717,11 @@ __glXVertexAttribs2dvNVReqSize(const GLb
523 - return __GLX_PAD((n * 16));
524 + return safe_pad(safe_mul(n, 16));
528 -__glXVertexAttribs3dvNVReqSize(const GLbyte * pc, Bool swap)
529 +__glXVertexAttribs3dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen)
531 GLsizei n = *(GLsizei *) (pc + 4);
533 @@ -731,11 +729,11 @@ __glXVertexAttribs3dvNVReqSize(const GLb
537 - return __GLX_PAD((n * 24));
538 + return safe_pad(safe_mul(n, 24));
542 -__glXVertexAttribs3fvNVReqSize(const GLbyte * pc, Bool swap)
543 +__glXVertexAttribs3fvNVReqSize(const GLbyte * pc, Bool swap, int reqlen)
545 GLsizei n = *(GLsizei *) (pc + 4);
547 @@ -743,11 +741,11 @@ __glXVertexAttribs3fvNVReqSize(const GLb
551 - return __GLX_PAD((n * 12));
552 + return safe_pad(safe_mul(n, 12));
556 -__glXVertexAttribs3svNVReqSize(const GLbyte * pc, Bool swap)
557 +__glXVertexAttribs3svNVReqSize(const GLbyte * pc, Bool swap, int reqlen)
559 GLsizei n = *(GLsizei *) (pc + 4);
561 @@ -755,11 +753,11 @@ __glXVertexAttribs3svNVReqSize(const GLb
565 - return __GLX_PAD((n * 6));
566 + return safe_pad(safe_mul(n, 6));
570 -__glXVertexAttribs4dvNVReqSize(const GLbyte * pc, Bool swap)
571 +__glXVertexAttribs4dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen)
573 GLsizei n = *(GLsizei *) (pc + 4);
575 @@ -767,7 +765,7 @@ __glXVertexAttribs4dvNVReqSize(const GLb
579 - return __GLX_PAD((n * 32));
580 + return safe_pad(safe_mul(n, 32));
584 --- a/glx/indirect_reqsize.h
585 +++ b/glx/indirect_reqsize.h
586 @@ -36,115 +36,156 @@
590 -extern PURE _X_HIDDEN int __glXCallListsReqSize(const GLbyte * pc, Bool swap);
591 -extern PURE _X_HIDDEN int __glXBitmapReqSize(const GLbyte * pc, Bool swap);
592 -extern PURE _X_HIDDEN int __glXFogfvReqSize(const GLbyte * pc, Bool swap);
593 -extern PURE _X_HIDDEN int __glXFogivReqSize(const GLbyte * pc, Bool swap);
594 -extern PURE _X_HIDDEN int __glXLightfvReqSize(const GLbyte * pc, Bool swap);
595 -extern PURE _X_HIDDEN int __glXLightivReqSize(const GLbyte * pc, Bool swap);
596 -extern PURE _X_HIDDEN int __glXLightModelfvReqSize(const GLbyte * pc,
598 -extern PURE _X_HIDDEN int __glXLightModelivReqSize(const GLbyte * pc,
600 -extern PURE _X_HIDDEN int __glXMaterialfvReqSize(const GLbyte * pc, Bool swap);
601 -extern PURE _X_HIDDEN int __glXMaterialivReqSize(const GLbyte * pc, Bool swap);
602 +extern PURE _X_HIDDEN int __glXCallListsReqSize(const GLbyte * pc, Bool swap,
604 +extern PURE _X_HIDDEN int __glXBitmapReqSize(const GLbyte * pc, Bool swap,
606 +extern PURE _X_HIDDEN int __glXFogfvReqSize(const GLbyte * pc, Bool swap,
608 +extern PURE _X_HIDDEN int __glXFogivReqSize(const GLbyte * pc, Bool swap,
610 +extern PURE _X_HIDDEN int __glXLightfvReqSize(const GLbyte * pc, Bool swap,
612 +extern PURE _X_HIDDEN int __glXLightivReqSize(const GLbyte * pc, Bool swap,
614 +extern PURE _X_HIDDEN int __glXLightModelfvReqSize(const GLbyte * pc, Bool swap,
616 +extern PURE _X_HIDDEN int __glXLightModelivReqSize(const GLbyte * pc, Bool swap,
618 +extern PURE _X_HIDDEN int __glXMaterialfvReqSize(const GLbyte * pc, Bool swap,
620 +extern PURE _X_HIDDEN int __glXMaterialivReqSize(const GLbyte * pc, Bool swap,
622 extern PURE _X_HIDDEN int __glXPolygonStippleReqSize(const GLbyte * pc,
624 + Bool swap, int reqlen);
625 extern PURE _X_HIDDEN int __glXTexParameterfvReqSize(const GLbyte * pc,
627 + Bool swap, int reqlen);
628 extern PURE _X_HIDDEN int __glXTexParameterivReqSize(const GLbyte * pc,
630 -extern PURE _X_HIDDEN int __glXTexImage1DReqSize(const GLbyte * pc, Bool swap);
631 -extern PURE _X_HIDDEN int __glXTexImage2DReqSize(const GLbyte * pc, Bool swap);
632 -extern PURE _X_HIDDEN int __glXTexEnvfvReqSize(const GLbyte * pc, Bool swap);
633 -extern PURE _X_HIDDEN int __glXTexEnvivReqSize(const GLbyte * pc, Bool swap);
634 -extern PURE _X_HIDDEN int __glXTexGendvReqSize(const GLbyte * pc, Bool swap);
635 -extern PURE _X_HIDDEN int __glXTexGenfvReqSize(const GLbyte * pc, Bool swap);
636 -extern PURE _X_HIDDEN int __glXTexGenivReqSize(const GLbyte * pc, Bool swap);
637 -extern PURE _X_HIDDEN int __glXMap1dReqSize(const GLbyte * pc, Bool swap);
638 -extern PURE _X_HIDDEN int __glXMap1fReqSize(const GLbyte * pc, Bool swap);
639 -extern PURE _X_HIDDEN int __glXMap2dReqSize(const GLbyte * pc, Bool swap);
640 -extern PURE _X_HIDDEN int __glXMap2fReqSize(const GLbyte * pc, Bool swap);
641 -extern PURE _X_HIDDEN int __glXPixelMapfvReqSize(const GLbyte * pc, Bool swap);
642 -extern PURE _X_HIDDEN int __glXPixelMapuivReqSize(const GLbyte * pc, Bool swap);
643 -extern PURE _X_HIDDEN int __glXPixelMapusvReqSize(const GLbyte * pc, Bool swap);
644 -extern PURE _X_HIDDEN int __glXDrawPixelsReqSize(const GLbyte * pc, Bool swap);
645 -extern PURE _X_HIDDEN int __glXDrawArraysReqSize(const GLbyte * pc, Bool swap);
646 + Bool swap, int reqlen);
647 +extern PURE _X_HIDDEN int __glXTexImage1DReqSize(const GLbyte * pc, Bool swap,
649 +extern PURE _X_HIDDEN int __glXTexImage2DReqSize(const GLbyte * pc, Bool swap,
651 +extern PURE _X_HIDDEN int __glXTexEnvfvReqSize(const GLbyte * pc, Bool swap,
653 +extern PURE _X_HIDDEN int __glXTexEnvivReqSize(const GLbyte * pc, Bool swap,
655 +extern PURE _X_HIDDEN int __glXTexGendvReqSize(const GLbyte * pc, Bool swap,
657 +extern PURE _X_HIDDEN int __glXTexGenfvReqSize(const GLbyte * pc, Bool swap,
659 +extern PURE _X_HIDDEN int __glXTexGenivReqSize(const GLbyte * pc, Bool swap,
661 +extern PURE _X_HIDDEN int __glXMap1dReqSize(const GLbyte * pc, Bool swap,
663 +extern PURE _X_HIDDEN int __glXMap1fReqSize(const GLbyte * pc, Bool swap,
665 +extern PURE _X_HIDDEN int __glXMap2dReqSize(const GLbyte * pc, Bool swap,
667 +extern PURE _X_HIDDEN int __glXMap2fReqSize(const GLbyte * pc, Bool swap,
669 +extern PURE _X_HIDDEN int __glXPixelMapfvReqSize(const GLbyte * pc, Bool swap,
671 +extern PURE _X_HIDDEN int __glXPixelMapuivReqSize(const GLbyte * pc, Bool swap,
673 +extern PURE _X_HIDDEN int __glXPixelMapusvReqSize(const GLbyte * pc, Bool swap,
675 +extern PURE _X_HIDDEN int __glXDrawPixelsReqSize(const GLbyte * pc, Bool swap,
677 +extern PURE _X_HIDDEN int __glXDrawArraysReqSize(const GLbyte * pc, Bool swap,
679 extern PURE _X_HIDDEN int __glXPrioritizeTexturesReqSize(const GLbyte * pc,
681 + Bool swap, int reqlen);
682 extern PURE _X_HIDDEN int __glXTexSubImage1DReqSize(const GLbyte * pc,
684 + Bool swap, int reqlen);
685 extern PURE _X_HIDDEN int __glXTexSubImage2DReqSize(const GLbyte * pc,
687 -extern PURE _X_HIDDEN int __glXColorTableReqSize(const GLbyte * pc, Bool swap);
688 + Bool swap, int reqlen);
689 +extern PURE _X_HIDDEN int __glXColorTableReqSize(const GLbyte * pc, Bool swap,
691 extern PURE _X_HIDDEN int __glXColorTableParameterfvReqSize(const GLbyte * pc,
695 extern PURE _X_HIDDEN int __glXColorTableParameterivReqSize(const GLbyte * pc,
699 extern PURE _X_HIDDEN int __glXColorSubTableReqSize(const GLbyte * pc,
701 + Bool swap, int reqlen);
702 extern PURE _X_HIDDEN int __glXConvolutionFilter1DReqSize(const GLbyte * pc,
706 extern PURE _X_HIDDEN int __glXConvolutionFilter2DReqSize(const GLbyte * pc,
710 extern PURE _X_HIDDEN int __glXConvolutionParameterfvReqSize(const GLbyte * pc,
714 extern PURE _X_HIDDEN int __glXConvolutionParameterivReqSize(const GLbyte * pc,
718 extern PURE _X_HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte * pc,
720 -extern PURE _X_HIDDEN int __glXTexImage3DReqSize(const GLbyte * pc, Bool swap);
721 + Bool swap, int reqlen);
722 +extern PURE _X_HIDDEN int __glXTexImage3DReqSize(const GLbyte * pc, Bool swap,
724 extern PURE _X_HIDDEN int __glXTexSubImage3DReqSize(const GLbyte * pc,
726 + Bool swap, int reqlen);
727 extern PURE _X_HIDDEN int __glXCompressedTexImage1DReqSize(const GLbyte * pc,
731 extern PURE _X_HIDDEN int __glXCompressedTexImage2DReqSize(const GLbyte * pc,
735 extern PURE _X_HIDDEN int __glXCompressedTexImage3DReqSize(const GLbyte * pc,
739 extern PURE _X_HIDDEN int __glXCompressedTexSubImage1DReqSize(const GLbyte * pc,
743 extern PURE _X_HIDDEN int __glXCompressedTexSubImage2DReqSize(const GLbyte * pc,
747 extern PURE _X_HIDDEN int __glXCompressedTexSubImage3DReqSize(const GLbyte * pc,
751 extern PURE _X_HIDDEN int __glXPointParameterfvReqSize(const GLbyte * pc,
753 + Bool swap, int reqlen);
754 extern PURE _X_HIDDEN int __glXPointParameterivReqSize(const GLbyte * pc,
756 -extern PURE _X_HIDDEN int __glXDrawBuffersReqSize(const GLbyte * pc, Bool swap);
757 + Bool swap, int reqlen);
758 +extern PURE _X_HIDDEN int __glXDrawBuffersReqSize(const GLbyte * pc, Bool swap,
760 extern PURE _X_HIDDEN int __glXProgramStringARBReqSize(const GLbyte * pc,
762 + Bool swap, int reqlen);
763 extern PURE _X_HIDDEN int __glXDeleteFramebuffersReqSize(const GLbyte * pc,
765 + Bool swap, int reqlen);
766 extern PURE _X_HIDDEN int __glXDeleteRenderbuffersReqSize(const GLbyte * pc,
770 extern PURE _X_HIDDEN int __glXVertexAttribs1dvNVReqSize(const GLbyte * pc,
772 + Bool swap, int reqlen);
773 extern PURE _X_HIDDEN int __glXVertexAttribs1fvNVReqSize(const GLbyte * pc,
775 + Bool swap, int reqlen);
776 extern PURE _X_HIDDEN int __glXVertexAttribs1svNVReqSize(const GLbyte * pc,
778 + Bool swap, int reqlen);
779 extern PURE _X_HIDDEN int __glXVertexAttribs2dvNVReqSize(const GLbyte * pc,
781 + Bool swap, int reqlen);
782 extern PURE _X_HIDDEN int __glXVertexAttribs2fvNVReqSize(const GLbyte * pc,
784 + Bool swap, int reqlen);
785 extern PURE _X_HIDDEN int __glXVertexAttribs2svNVReqSize(const GLbyte * pc,
787 + Bool swap, int reqlen);
788 extern PURE _X_HIDDEN int __glXVertexAttribs3dvNVReqSize(const GLbyte * pc,
790 + Bool swap, int reqlen);
791 extern PURE _X_HIDDEN int __glXVertexAttribs3fvNVReqSize(const GLbyte * pc,
793 + Bool swap, int reqlen);
794 extern PURE _X_HIDDEN int __glXVertexAttribs3svNVReqSize(const GLbyte * pc,
796 + Bool swap, int reqlen);
797 extern PURE _X_HIDDEN int __glXVertexAttribs4dvNVReqSize(const GLbyte * pc,
799 + Bool swap, int reqlen);
800 extern PURE _X_HIDDEN int __glXVertexAttribs4fvNVReqSize(const GLbyte * pc,
802 + Bool swap, int reqlen);
803 extern PURE _X_HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte * pc,
805 + Bool swap, int reqlen);
806 extern PURE _X_HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte * pc,
816 ((a & 0xff00U)<<8) | ((a & 0xffU)<<24))
819 -__glXMap1dReqSize(const GLbyte * pc, Bool swap)
820 +__glXMap1dReqSize(const GLbyte * pc, Bool swap, int reqlen)
824 @@ -61,7 +61,7 @@ __glXMap1dReqSize(const GLbyte * pc, Boo
828 -__glXMap1fReqSize(const GLbyte * pc, Bool swap)
829 +__glXMap1fReqSize(const GLbyte * pc, Bool swap, int reqlen)
833 @@ -86,7 +86,7 @@ Map2Size(int k, int majorOrder, int mino
837 -__glXMap2dReqSize(const GLbyte * pc, Bool swap)
838 +__glXMap2dReqSize(const GLbyte * pc, Bool swap, int reqlen)
841 GLint uorder, vorder;
842 @@ -103,7 +103,7 @@ __glXMap2dReqSize(const GLbyte * pc, Boo
846 -__glXMap2fReqSize(const GLbyte * pc, Bool swap)
847 +__glXMap2fReqSize(const GLbyte * pc, Bool swap, int reqlen)
850 GLint uorder, vorder;
851 @@ -359,13 +359,14 @@ __glXTypeSize(GLenum enm)
855 -__glXDrawArraysReqSize(const GLbyte * pc, Bool swap)
856 +__glXDrawArraysReqSize(const GLbyte * pc, Bool swap, int reqlen)
858 __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *) pc;
859 __GLXdispatchDrawArraysComponentHeader *compHeader;
860 GLint numVertexes = hdr->numVertexes;
861 GLint numComponents = hdr->numComponents;
862 GLint arrayElementSize = 0;
867 @@ -374,6 +375,13 @@ __glXDrawArraysReqSize(const GLbyte * pc
870 pc += sizeof(__GLXdispatchDrawArraysHeader);
871 + reqlen -= sizeof(__GLXdispatchDrawArraysHeader);
873 + size = safe_mul(sizeof(__GLXdispatchDrawArraysComponentHeader),
875 + if (size < 0 || reqlen < 0 || reqlen < size)
878 compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc;
880 for (i = 0; i < numComponents; i++) {
881 @@ -417,17 +425,18 @@ __glXDrawArraysReqSize(const GLbyte * pc
885 - arrayElementSize += __GLX_PAD(numVals * __glXTypeSize(datatype));
886 + x = safe_pad(safe_mul(numVals, __glXTypeSize(datatype)));
887 + if ((arrayElementSize = safe_add(arrayElementSize, x)) < 0)
890 pc += sizeof(__GLXdispatchDrawArraysComponentHeader);
893 - return ((numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader)) +
894 - (numVertexes * arrayElementSize));
895 + return safe_add(size, safe_mul(numVertexes, arrayElementSize));
899 -__glXSeparableFilter2DReqSize(const GLbyte * pc, Bool swap)
900 +__glXSeparableFilter2DReqSize(const GLbyte * pc, Bool swap, int reqlen)
902 __GLXdispatchConvolutionFilterHeader *hdr =
903 (__GLXdispatchConvolutionFilterHeader *) pc;