[Mesa-dev] [PATCH 8/8] mesa: fix error handling for glSelectBuffer

Yuanhan Liu yuanhan.liu at linux.intel.com
Mon Sep 19 00:03:04 PDT 2011


According the man page, trigger a GL_INVALID_VALUE if size < 0.

Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
---
 src/mesa/main/feedback.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c
index 597ec1e..d73aa08 100644
--- a/src/mesa/main/feedback.c
+++ b/src/mesa/main/feedback.c
@@ -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 */
-- 
1.7.4.4



More information about the mesa-dev mailing list