Mesa (9.0): mesa: fix glCompressedTexSubImage assertion/segfault
Brian Paul
brianp at kemper.freedesktop.org
Tue Oct 2 13:20:35 UTC 2012
Module: Mesa
Branch: 9.0
Commit: 604cd6b966d060334fdaa11ae8444797d54d3142
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=604cd6b966d060334fdaa11ae8444797d54d3142
Author: Brian Paul <brianp at vmware.com>
Date: Thu Sep 27 06:31:25 2012 -0600
mesa: fix glCompressedTexSubImage assertion/segfault
If the destination texture image doesn't exist we'd hit an assertion
(or crash in a release build). The piglit/s3tc-errors test hits this.
This has already been fixed in master by the error checking code
consolidation.
Note: This is a candidate for the 8.0 branch.
---
src/mesa/main/teximage.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index e764dd4..4b7fd1c 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3659,6 +3659,11 @@ compressed_subtexture_error_check2(struct gl_context *ctx, GLuint dims,
GLsizei depth, GLenum format,
struct gl_texture_image *texImage)
{
+ if (!texImage) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glCompressedTexSubImage%uD(undefined image level)", dims);
+ return GL_TRUE;
+ }
if ((GLint) format != texImage->InternalFormat) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -3770,7 +3775,6 @@ compressed_tex_sub_image(GLuint dims, GLenum target, GLint level,
_mesa_lock_texture(ctx, texObj);
{
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
- assert(texImage);
if (compressed_subtexture_error_check2(ctx, dims, width, height, depth,
format, texImage)) {
More information about the mesa-commit
mailing list