summaryrefslogtreecommitdiff
path: root/src/glx/x11/indirect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx/x11/indirect.c')
-rw-r--r--src/glx/x11/indirect.c393
1 files changed, 360 insertions, 33 deletions
diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c
index fbb2a91956..82e1b2edcc 100644
--- a/src/glx/x11/indirect.c
+++ b/src/glx/x11/indirect.c
@@ -300,7 +300,9 @@ __indirect_glNewList(GLuint list, GLenum mode)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -324,7 +326,9 @@ __indirect_glEndList(void)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 0;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -360,6 +364,10 @@ __indirect_glCallLists(GLsizei n, GLenum type, const GLvoid * lists)
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint compsize = __glCallLists_size(type);
const GLuint cmdlen = 12 + __GLX_PAD((compsize * n));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((n >= 0) && (gc->currentDpy != NULL), 1)) {
if (cmdlen <= gc->maxSmallRenderCommandSize) {
if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -393,7 +401,9 @@ __indirect_glDeleteLists(GLuint list, GLsizei range)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -418,7 +428,9 @@ __indirect_glGenLists(GLsizei range)
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
GLuint retval = (GLuint) 0;
+#ifndef USE_XCB
const GLuint cmdlen = 4;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -3582,6 +3594,10 @@ __indirect_glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat * values)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 4));
+ if (mapsize < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((mapsize >= 0) && (gc->currentDpy != NULL), 1)) {
if (cmdlen <= gc->maxSmallRenderCommandSize) {
if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -3615,6 +3631,10 @@ __indirect_glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint * values)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 4));
+ if (mapsize < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((mapsize >= 0) && (gc->currentDpy != NULL), 1)) {
if (cmdlen <= gc->maxSmallRenderCommandSize) {
if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -3648,6 +3668,10 @@ __indirect_glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort * values)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 2));
+ if (mapsize < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((mapsize >= 0) && (gc->currentDpy != NULL), 1)) {
if (cmdlen <= gc->maxSmallRenderCommandSize) {
if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -3716,7 +3740,9 @@ __indirect_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 28;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -3808,7 +3834,9 @@ __indirect_glGetClipPlane(GLenum plane, GLdouble * equation)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 4;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -3841,7 +3869,9 @@ __indirect_glGetLightfv(GLenum light, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -3879,7 +3909,9 @@ __indirect_glGetLightiv(GLenum light, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -3917,7 +3949,9 @@ __indirect_glGetMapdv(GLenum target, GLenum query, GLdouble * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -3953,7 +3987,9 @@ __indirect_glGetMapfv(GLenum target, GLenum query, GLfloat * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -3989,7 +4025,9 @@ __indirect_glGetMapiv(GLenum target, GLenum query, GLint * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4025,7 +4063,9 @@ __indirect_glGetMaterialfv(GLenum face, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4063,7 +4103,9 @@ __indirect_glGetMaterialiv(GLenum face, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4101,7 +4143,9 @@ __indirect_glGetPixelMapfv(GLenum map, GLfloat * values)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 4;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4137,7 +4181,9 @@ __indirect_glGetPixelMapuiv(GLenum map, GLuint * values)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 4;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4174,7 +4220,9 @@ __indirect_glGetPixelMapusv(GLenum map, GLushort * values)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 4;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4210,9 +4258,10 @@ void
__indirect_glGetPolygonStipple(GLubyte *mask)
{
__GLXcontext *const gc = __glXGetCurrentContext();
- const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 4;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4247,7 +4296,9 @@ __indirect_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4285,7 +4336,9 @@ __indirect_glGetTexEnviv(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4323,7 +4376,9 @@ __indirect_glGetTexGendv(GLenum coord, GLenum pname, GLdouble * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4361,7 +4416,9 @@ __indirect_glGetTexGenfv(GLenum coord, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4399,7 +4456,9 @@ __indirect_glGetTexGeniv(GLenum coord, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4439,7 +4498,9 @@ __indirect_glGetTexImage(GLenum target, GLint level, GLenum format,
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 20;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4483,7 +4544,9 @@ __indirect_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4522,7 +4585,9 @@ __indirect_glGetTexParameteriv(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4562,7 +4627,9 @@ __indirect_glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname,
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 12;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4603,7 +4670,9 @@ __indirect_glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname,
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 12;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4644,7 +4713,9 @@ __indirect_glIsList(GLuint list)
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
GLboolean retval = (GLboolean) 0;
+#ifndef USE_XCB
const GLuint cmdlen = 4;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5012,7 +5083,13 @@ __indirect_glAreTexturesResident(GLsizei n, const GLuint * textures,
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
GLboolean retval = (GLboolean) 0;
+#ifndef USE_XCB
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+#endif
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return 0;
+ }
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5047,14 +5124,21 @@ glAreTexturesResidentEXT(GLsizei n, const GLuint * textures,
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
return CALL_AreTexturesResident(GET_DISPATCH(),
(n, textures, residences));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
GLboolean retval = (GLboolean) 0;
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return 0;
+ }
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
GLubyte const *pc =
__glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
@@ -5163,7 +5247,13 @@ __indirect_glDeleteTextures(GLsizei n, const GLuint * textures)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+#endif
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5187,12 +5277,19 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures)
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
CALL_DeleteTextures(GET_DISPATCH(), (n, textures));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
GLubyte const *pc =
__glXSetupVendorRequest(gc, X_GLXVendorPrivate,
@@ -5212,7 +5309,13 @@ __indirect_glGenTextures(GLsizei n, GLuint * textures)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 4;
+#endif
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5245,12 +5348,19 @@ glGenTexturesEXT(GLsizei n, GLuint * textures)
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
CALL_GenTextures(GET_DISPATCH(), (n, textures));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 4;
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
GLubyte const *pc =
__glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
@@ -5271,7 +5381,9 @@ __indirect_glIsTexture(GLuint texture)
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
GLboolean retval = (GLboolean) 0;
+#ifndef USE_XCB
const GLuint cmdlen = 4;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5301,9 +5413,12 @@ glIsTextureEXT(GLuint texture)
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
return CALL_IsTexture(GET_DISPATCH(), (texture));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
GLboolean retval = (GLboolean) 0;
@@ -5328,6 +5443,10 @@ __indirect_glPrioritizeTextures(GLsizei n, const GLuint * textures,
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 8 + __GLX_PAD((n * 4)) + __GLX_PAD((n * 4));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_PrioritizeTextures, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
@@ -5565,7 +5684,9 @@ __indirect_glGetColorTable(GLenum target, GLenum format, GLenum type,
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 16;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5609,9 +5730,12 @@ glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table)
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
@@ -5641,7 +5765,9 @@ __indirect_glGetColorTableParameterfv(GLenum target, GLenum pname,
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5680,10 +5806,13 @@ glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
CALL_GetColorTableParameterfv(GET_DISPATCH(),
(target, pname, params));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -5709,7 +5838,9 @@ __indirect_glGetColorTableParameteriv(GLenum target, GLenum pname,
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5748,10 +5879,13 @@ glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
CALL_GetColorTableParameteriv(GET_DISPATCH(),
(target, pname, params));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6029,7 +6163,9 @@ __indirect_glGetConvolutionFilter(GLenum target, GLenum format, GLenum type,
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 16;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -6069,10 +6205,13 @@ gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type,
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
CALL_GetConvolutionFilter(GET_DISPATCH(),
(target, format, type, image));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
@@ -6103,7 +6242,9 @@ __indirect_glGetConvolutionParameterfv(GLenum target, GLenum pname,
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -6142,10 +6283,13 @@ gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
CALL_GetConvolutionParameterfv(GET_DISPATCH(),
(target, pname, params));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6171,7 +6315,9 @@ __indirect_glGetConvolutionParameteriv(GLenum target, GLenum pname,
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -6210,10 +6356,13 @@ gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
CALL_GetConvolutionParameteriv(GET_DISPATCH(),
(target, pname, params));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6240,7 +6389,9 @@ __indirect_glGetHistogram(GLenum target, GLboolean reset, GLenum format,
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 16;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -6285,10 +6436,13 @@ gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format,
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
CALL_GetHistogram(GET_DISPATCH(),
(target, reset, format, type, values));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
@@ -6319,7 +6473,9 @@ __indirect_glGetHistogramParameterfv(GLenum target, GLenum pname,
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -6357,9 +6513,12 @@ gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6385,7 +6544,9 @@ __indirect_glGetHistogramParameteriv(GLenum target, GLenum pname,
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -6423,9 +6584,12 @@ gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6452,7 +6616,9 @@ __indirect_glGetMinmax(GLenum target, GLboolean reset, GLenum format,
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 16;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -6493,9 +6659,12 @@ gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format,
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
@@ -6526,7 +6695,9 @@ __indirect_glGetMinmaxParameterfv(GLenum target, GLenum pname,
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -6562,9 +6733,12 @@ gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6589,7 +6763,9 @@ __indirect_glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -6625,9 +6801,12 @@ gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
- if (gc->isDirect) {
+#ifdef GLX_DIRECT_RENDERING
+ if (gc->driContext) {
CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params));
- } else {
+ } else
+#endif
+ {
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -7585,6 +7764,10 @@ __indirect_glProgramStringARB(GLenum target, GLenum format, GLsizei len,
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 16 + __GLX_PAD(len);
+ if (len < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((len >= 0) && (gc->currentDpy != NULL), 1)) {
if (cmdlen <= gc->maxSmallRenderCommandSize) {
if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -8200,7 +8383,13 @@ __indirect_glDeleteQueriesARB(GLsizei n, const GLuint * ids)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+#endif
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -8238,7 +8427,13 @@ __indirect_glGenQueriesARB(GLsizei n, GLuint * ids)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 4;
+#endif
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -8271,7 +8466,9 @@ __indirect_glGetQueryObjectivARB(GLuint id, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -8307,7 +8504,9 @@ __indirect_glGetQueryObjectuivARB(GLuint id, GLenum pname, GLuint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -8343,7 +8542,9 @@ __indirect_glGetQueryivARB(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
const GLuint cmdlen = 8;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -8383,7 +8584,9 @@ __indirect_glIsQueryARB(GLuint id)
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
GLboolean retval = (GLboolean) 0;
+#ifndef USE_XCB
const GLuint cmdlen = 4;
+#endif
if (__builtin_expect(dpy != NULL, 1)) {
#ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -8414,6 +8617,10 @@ __indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((n >= 0) && (gc->currentDpy != NULL), 1)) {
if (cmdlen <= gc->maxSmallRenderCommandSize) {
if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -8774,6 +8981,10 @@ __indirect_glAreProgramsResidentNV(GLsizei n, const GLuint * ids,
Display *const dpy = gc->currentDpy;
GLboolean retval = (GLboolean) 0;
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return 0;
+ }
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
GLubyte const *pc =
__glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
@@ -8809,6 +9020,10 @@ __indirect_glDeleteProgramsNV(GLsizei n, const GLuint * programs)
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
GLubyte const *pc =
__glXSetupVendorRequest(gc, X_GLXVendorPrivate,
@@ -8845,6 +9060,10 @@ __indirect_glGenProgramsNV(GLsizei n, GLuint * programs)
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 4;
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
GLubyte const *pc =
__glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
@@ -9051,6 +9270,10 @@ __indirect_glLoadProgramNV(GLenum target, GLuint id, GLsizei len,
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 16 + __GLX_PAD(len);
+ if (len < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(len >= 0, 1)) {
emit_header(gc->pc, X_GLrop_LoadProgramNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
@@ -9071,6 +9294,10 @@ __indirect_glProgramParameters4dvNV(GLenum target, GLuint index, GLuint num,
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 16 + __GLX_PAD((num * 32));
+ if (num < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(num >= 0, 1)) {
emit_header(gc->pc, X_GLrop_ProgramParameters4dvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
@@ -9091,6 +9318,10 @@ __indirect_glProgramParameters4fvNV(GLenum target, GLuint index, GLuint num,
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 16 + __GLX_PAD((num * 16));
+ if (num < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(num >= 0, 1)) {
emit_header(gc->pc, X_GLrop_ProgramParameters4fvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
@@ -9110,6 +9341,10 @@ __indirect_glRequestResidentProgramsNV(GLsizei n, const GLuint * ids)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_RequestResidentProgramsNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
@@ -9561,6 +9796,10 @@ __indirect_glVertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((n * 8));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_VertexAttribs1dvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9579,6 +9818,10 @@ __indirect_glVertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_VertexAttribs1fvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9597,6 +9840,10 @@ __indirect_glVertexAttribs1svNV(GLuint index, GLsizei n, const GLshort * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((n * 2));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_VertexAttribs1svNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9615,6 +9862,10 @@ __indirect_glVertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((n * 16));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_VertexAttribs2dvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9633,6 +9884,10 @@ __indirect_glVertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((n * 8));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_VertexAttribs2fvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9651,6 +9906,10 @@ __indirect_glVertexAttribs2svNV(GLuint index, GLsizei n, const GLshort * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_VertexAttribs2svNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9669,6 +9928,10 @@ __indirect_glVertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((n * 24));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_VertexAttribs3dvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9687,6 +9950,10 @@ __indirect_glVertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((n * 12));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_VertexAttribs3fvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9705,6 +9972,10 @@ __indirect_glVertexAttribs3svNV(GLuint index, GLsizei n, const GLshort * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((n * 6));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_VertexAttribs3svNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9723,6 +9994,10 @@ __indirect_glVertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((n * 32));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_VertexAttribs4dvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9741,6 +10016,10 @@ __indirect_glVertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((n * 16));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_VertexAttribs4fvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9759,6 +10038,10 @@ __indirect_glVertexAttribs4svNV(GLuint index, GLsizei n, const GLshort * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((n * 8));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_VertexAttribs4svNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9777,6 +10060,10 @@ __indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_VertexAttribs4ubvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9843,6 +10130,10 @@ __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len,
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8 + __GLX_PAD(len);
+ if (len < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((len >= 0) && (dpy != NULL), 1)) {
GLubyte const *pc =
__glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
@@ -9867,6 +10158,10 @@ __indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len,
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8 + __GLX_PAD(len);
+ if (len < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((len >= 0) && (dpy != NULL), 1)) {
GLubyte const *pc =
__glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
@@ -9890,6 +10185,10 @@ __indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len,
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 44 + __GLX_PAD(len);
+ if (len < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(len >= 0, 1)) {
emit_header(gc->pc, X_GLrop_ProgramNamedParameter4dvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
@@ -9914,6 +10213,10 @@ __indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len,
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 44 + __GLX_PAD(len);
+ if (len < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(len >= 0, 1)) {
emit_header(gc->pc, X_GLrop_ProgramNamedParameter4dvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (v), 32);
@@ -9935,6 +10238,10 @@ __indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len,
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 28 + __GLX_PAD(len);
+ if (len < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(len >= 0, 1)) {
emit_header(gc->pc, X_GLrop_ProgramNamedParameter4fvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&id), 4);
@@ -9959,6 +10266,10 @@ __indirect_glProgramNamedParameter4fvNV(GLuint id, GLsizei len,
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 28 + __GLX_PAD(len);
+ if (len < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(len >= 0, 1)) {
emit_header(gc->pc, X_GLrop_ProgramNamedParameter4fvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&id), 4);
@@ -10044,6 +10355,10 @@ __indirect_glDeleteFramebuffersEXT(GLsizei n, const GLuint * framebuffers)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_DeleteFramebuffersEXT, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
@@ -10062,6 +10377,10 @@ __indirect_glDeleteRenderbuffersEXT(GLsizei n, const GLuint * renderbuffers)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_DeleteRenderbuffersEXT, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
@@ -10161,6 +10480,10 @@ __indirect_glGenFramebuffersEXT(GLsizei n, GLuint * framebuffers)
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 4;
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
GLubyte const *pc =
__glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
@@ -10180,6 +10503,10 @@ __indirect_glGenRenderbuffersEXT(GLsizei n, GLuint * renderbuffers)
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 4;
+ if (n < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
GLubyte const *pc =
__glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,