[Mesa-dev] [PATCH 3/3] mesa: add missing error checks in _mesa_GetObject[Ptr]Label()
Brian Paul
brianp at vmware.com
Sat Sep 14 09:16:21 PDT 2013
---
src/mesa/main/objectlabel.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c
index bfe9ba2..c373a46 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;
--
1.7.10.4
More information about the mesa-dev
mailing list