[Mesa-dev] [PATCH] mesa: generate error if pbo offset is not aligned with the size of specified type
Yuanhan Liu
yuanhan.liu at linux.intel.com
Thu Oct 13 18:46:16 PDT 2011
Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
---
src/mesa/main/pbo.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c
index 4e7e6f9..4611c5d 100644
--- a/src/mesa/main/pbo.c
+++ b/src/mesa/main/pbo.c
@@ -82,6 +82,11 @@ _mesa_validate_pbo_access(GLuint dimensions,
} else {
offset = ptr;
sizeAddr = ((const GLubyte *) 0) + pack->BufferObj->Size;
+ if (_mesa_sizeof_type(type) &&
+ ((GLuint)offset % _mesa_sizeof_type(type))) {
+ /* offset not aligned with type size */
+ return GL_FALSE;
+ }
}
if (sizeAddr == 0)
--
1.7.4.4
More information about the mesa-dev
mailing list