summaryrefslogtreecommitdiff
path: root/src/mesa/main/api_validate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/api_validate.c')
-rw-r--r--src/mesa/main/api_validate.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 5a19993976..bbc5933ab9 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -119,6 +119,12 @@ _mesa_validate_DrawElements(GLcontext *ctx,
/* use indices in the buffer object */
GLuint indexBytes;
+ if (!ctx->Array.ElementArrayBufferObj->Size) {
+ _mesa_warning(ctx,
+ "glDrawElements called with empty array elements buffer");
+ return GL_FALSE;
+ }
+
if (type == GL_UNSIGNED_INT) {
indexBytes = count * sizeof(GLuint);
}
@@ -131,7 +137,7 @@ _mesa_validate_DrawElements(GLcontext *ctx,
}
/* make sure count doesn't go outside buffer bounds */
- if (indexBytes > ctx->Array.ElementArrayBufferObj->Size) {
+ if (indexBytes > (GLuint) ctx->Array.ElementArrayBufferObj->Size) {
_mesa_warning(ctx, "glDrawElements index out of buffer bounds");
return GL_FALSE;
}