Mesa (master): mesa: add out of bounds assertions for accessing texture matrix stack

Brian Paul brianp at kemper.freedesktop.org
Wed Feb 3 22:51:44 UTC 2010


Module: Mesa
Branch: master
Commit: 376ae23c3a226399f9f33be716f3990ff4442580
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=376ae23c3a226399f9f33be716f3990ff4442580

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Feb  3 12:25:28 2010 -0700

mesa: add out of bounds assertions for accessing texture matrix stack

---

 src/mesa/main/texstate.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 2b26f65..6f8831d 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -356,6 +356,7 @@ update_texture_matrices( GLcontext *ctx )
    ctx->Texture._TexMatEnabled = 0x0;
 
    for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
+      ASSERT(u < Elements(ctx->TextureMatrixStack));
       if (_math_matrix_is_dirty(ctx->TextureMatrixStack[u].Top)) {
 	 _math_matrix_analyse( ctx->TextureMatrixStack[u].Top );
 
@@ -627,6 +628,7 @@ update_texture_state( GLcontext *ctx )
 	 ctx->Texture._GenFlags |= texUnit->_GenFlags;
       }
 
+      ASSERT(unit < Elements(ctx->TextureMatrixStack));
       if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY)
 	 ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit);
    }




More information about the mesa-commit mailing list