diff options
| -rw-r--r-- | src/glx/x11/indirect.c | 180 | 
1 files changed, 180 insertions, 0 deletions
diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c index cb88c74632..a8a649c5e3 100644 --- a/src/glx/x11/indirect.c +++ b/src/glx/x11/indirect.c @@ -364,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) { @@ -3590,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) { @@ -3623,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) { @@ -3656,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) { @@ -5070,6 +5086,10 @@ __indirect_glAreTexturesResident(GLsizei n, const GLuint * textures,  #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); @@ -5112,6 +5132,10 @@ glAreTexturesResidentEXT(GLsizei n, const GLuint * textures,          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, @@ -5223,6 +5247,10 @@ __indirect_glDeleteTextures(GLsizei n, const GLuint * textures)  #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); @@ -5252,6 +5280,10 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures)          __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, @@ -5274,6 +5306,10 @@ __indirect_glGenTextures(GLsizei n, GLuint * textures)  #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); @@ -5312,6 +5348,10 @@ glGenTexturesEXT(GLsizei n, GLuint * textures)          __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, @@ -5391,6 +5431,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); @@ -7712,6 +7756,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) { @@ -8330,6 +8378,10 @@ __indirect_glDeleteQueriesARB(GLsizei n, const GLuint * ids)  #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); @@ -8370,6 +8422,10 @@ __indirect_glGenQueriesARB(GLsizei n, GLuint * ids)  #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); @@ -8553,6 +8609,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) { @@ -8913,6 +8973,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, @@ -8948,6 +9012,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, @@ -8984,6 +9052,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, @@ -9190,6 +9262,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); @@ -9210,6 +9286,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); @@ -9230,6 +9310,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); @@ -9249,6 +9333,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); @@ -9700,6 +9788,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); @@ -9718,6 +9810,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); @@ -9736,6 +9832,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); @@ -9754,6 +9854,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); @@ -9772,6 +9876,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); @@ -9790,6 +9898,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); @@ -9808,6 +9920,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); @@ -9826,6 +9942,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); @@ -9844,6 +9964,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); @@ -9862,6 +9986,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); @@ -9880,6 +10008,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); @@ -9898,6 +10030,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); @@ -9916,6 +10052,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); @@ -9982,6 +10122,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, @@ -10006,6 +10150,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, @@ -10029,6 +10177,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); @@ -10053,6 +10205,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); @@ -10074,6 +10230,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); @@ -10098,6 +10258,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); @@ -10183,6 +10347,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); @@ -10201,6 +10369,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); @@ -10300,6 +10472,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, @@ -10319,6 +10495,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,  | 
