aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/dlist.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-16 08:36:51 +0200
committermarha <marha@users.sourceforge.net>2011-09-16 08:36:51 +0200
commit18ae1470a8dbcfe369ddf0d7e17e0ea665251ccd (patch)
treeecf208df0badb85d34d35990d9194b5182411a10 /mesalib/src/mesa/main/dlist.c
parent4420369d700d9db1563f8647e1889c6a0972ea2c (diff)
downloadvcxsrv-18ae1470a8dbcfe369ddf0d7e17e0ea665251ccd.tar.gz
vcxsrv-18ae1470a8dbcfe369ddf0d7e17e0ea665251ccd.tar.bz2
vcxsrv-18ae1470a8dbcfe369ddf0d7e17e0ea665251ccd.zip
git update libXext libXdmcp mesa xkeyboard-config 16 sep 2011
X11/extensions: removed files that are in multiple extension modules
Diffstat (limited to 'mesalib/src/mesa/main/dlist.c')
-rw-r--r--mesalib/src/mesa/main/dlist.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index 6e075b4e5..2b2ff9015 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -871,7 +871,11 @@ translate_id(GLsizei n, GLenum type, const GLvoid * list)
/**
* Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
- * If we run out of memory, GL_OUT_OF_MEMORY will be recorded.
+ * If width < 0 or height < 0 or format or type are invalid we'll just
+ * return NULL. We will not generate an error since OpenGL command
+ * arguments aren't error-checked until the command is actually executed
+ * (not when they're compiled).
+ * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
*/
static GLvoid *
unpack_image(struct gl_context *ctx, GLuint dimensions,
@@ -879,6 +883,15 @@ unpack_image(struct gl_context *ctx, GLuint dimensions,
GLenum format, GLenum type, const GLvoid * pixels,
const struct gl_pixelstore_attrib *unpack)
{
+ if (width <= 0 || height <= 0) {
+ return NULL;
+ }
+
+ if (_mesa_bytes_per_pixel(format, type) <= 0) {
+ /* bad format and/or type */
+ return NULL;
+ }
+
if (!_mesa_is_bufferobj(unpack->BufferObj)) {
/* no PBO */
GLvoid *image = _mesa_unpack_image(dimensions, width, height, depth,