mesa: fix error handling for glSelectBuffer
authorYuanhan Liu <yuanhan.liu@linux.intel.com>
Mon, 19 Sep 2011 07:03:04 +0000 (15:03 +0800)
committerBrian Paul <brianp@vmware.com>
Mon, 19 Sep 2011 14:11:52 +0000 (08:11 -0600)
According the man page, trigger a GL_INVALID_VALUE if size < 0.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
src/mesa/main/feedback.c

index 597ec1e3f9aae0492b37bfa3df49a93e417b041e..d73aa08fa3d287cc3550190d55436da2d59a786b 100644 (file)
@@ -168,6 +168,11 @@ _mesa_SelectBuffer( GLsizei size, GLuint *buffer )
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
+   if (size < 0) {
+      _mesa_error(ctx, GL_INVALID_VALUE, "glSelectBuffer(size)");
+      return;
+   }
+
    if (ctx->RenderMode==GL_SELECT) {
       _mesa_error( ctx, GL_INVALID_OPERATION, "glSelectBuffer" );
       return;                  /* KW: added return */