summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/get_gen.py
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-02-03 12:31:27 -0700
committerBrian Paul <[email protected]>2010-02-03 15:48:42 -0700
commitd82c37134457263715b8c571827df58ea6789593 (patch)
tree43ca01e3c452e72510af3e44379cdf51f30f6df9 /src/mesa/main/get_gen.py
parenta06575aed66b818253bc79dcca3d6e19c92e4bba (diff)
mesa: add error check for querying invalid texture matrix
Diffstat (limited to 'src/mesa/main/get_gen.py')
-rw-r--r--src/mesa/main/get_gen.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index b0beb592075..7bd87bb0d7b 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -457,7 +457,15 @@ StateVars = [
"matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
"matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
"matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
- "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;", None ),
+ """const GLfloat *matrix;
+ const GLuint unit = ctx->Texture.CurrentUnit;
+ if (unit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGet(texture matrix %u)",
+ unit);
+ return;
+ }
+ matrix = ctx->TextureMatrixStack[unit].Top->m;""",
+ None ),
( "GL_TEXTURE_STACK_DEPTH", GLint,
["ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1"], "", None ),
( "GL_UNPACK_ALIGNMENT", GLint, ["ctx->Unpack.Alignment"], "", None ),