aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/objectlabel.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2013-09-14 09:59:18 -0600
committerBrian Paul <[email protected]>2013-10-01 10:10:01 -0600
commit79a03068cdde14c491894d44ee713ab5d08a9aca (patch)
tree12bfa3ea4ac9f08dff67674af76b20170df5af58 /src/mesa/main/objectlabel.c
parent69daf335a08934057ef6378b4bac6ca225a461dc (diff)
mesa: add missing error checks in _mesa_GetObject[Ptr]Label()
Error checking bufSize isn't mentioned in the spec, but it is in the man pages. However, I believe the man page is incorrect. Typically, GL functions that take GLsizei parameters check that they're positive or non-negative. Negative values don't make sense here. A spec bug has been filed with Khronos/ARB. v2: check for negative values, not <= 0.
Diffstat (limited to 'src/mesa/main/objectlabel.c')
-rw-r--r--src/mesa/main/objectlabel.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c
index bfe9ba20b34..e75fe3be26c 100644
--- a/src/mesa/main/objectlabel.c
+++ b/src/mesa/main/objectlabel.c
@@ -256,6 +256,12 @@ _mesa_GetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize,
GET_CURRENT_CONTEXT(ctx);
char **labelPtr;
+ if (bufSize < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetObjectLabel(bufSize = %d)",
+ bufSize);
+ return;
+ }
+
labelPtr = get_label_pointer(ctx, identifier, name, "glGetObjectLabel");
if (!labelPtr)
return;
@@ -288,6 +294,12 @@ _mesa_GetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length,
char **labelPtr;
struct gl_sync_object *const syncObj = (struct gl_sync_object *) ptr;
+ if (bufSize < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetObjectPtrLabel(bufSize = %d)",
+ bufSize);
+ return;
+ }
+
if (!_mesa_validate_sync(ctx, syncObj)) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetObjectPtrLabel (not a valid sync object)");
return;