mesa/pbo: Handle zero width, height or depth when validating access
[mesa.git] / src / mesa / main / pbo.c
index 0c16025320136b33680acba733a4e5301799f84f..7762324a4ae30caaa1a40cf8d043bf1bb9453d08 100644 (file)
@@ -103,6 +103,12 @@ _mesa_validate_pbo_access(GLuint dimensions,
       /* no buffer! */
       return GL_FALSE;
 
+   /* If the size of the image is zero then no pixels are accessed so we
+    * don't need to check anything else.
+    */
+   if (width == 0 || height == 0 || depth == 0)
+      return GL_TRUE;
+
    /* get the offset to the first pixel we'll read/write */
    start = _mesa_image_offset(dimensions, pack, width, height,
                               format, type, 0, 0, 0);