summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJian Zhao <[email protected]>2011-12-13 13:31:41 +0800
committerYuanhan Liu <[email protected]>2011-12-14 17:22:47 +0800
commit606d3a3c3de94665e47df47b48596293d588a420 (patch)
treeedd4e52c3ce682cefbb40b375ebb63ed6eeaff8c /src/mesa
parentc87cb98bb4e893e04831bf68231f5ed42e0b5b6f (diff)
Add mismatch check for glGetTexImage or it will return -1 and may lead to segment fault.
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/texgetimage.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index ae0d51fbb29..3f24187292b 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -708,6 +708,14 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,
return GL_TRUE;
}
+ if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+ /*GL_INVALID_OPERATION is generated by a format/type
+ * mismatch (see the 1.2 spec page 94, sec 3.6.4.)
+ */
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(target)");
+ return GL_TRUE;
+ }
+
baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
/* Make sure the requested image format is compatible with the