meta: Add assertion check for ctx->Meta->SaveStackDepth
authorAnuj Phogat <anuj.phogat@gmail.com>
Wed, 4 Feb 2015 01:04:45 +0000 (17:04 -0800)
committerAnuj Phogat <anuj.phogat@gmail.com>
Wed, 25 Feb 2015 22:10:59 +0000 (14:10 -0800)
before using it for derefrencing.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
src/mesa/drivers/common/meta.c

index dabf9345bb0b0f842df1e5acda9c8e71f87bb3fc..fdc4cf1e92743f1872cd2f5ffca17d045db8d125 100644 (file)
@@ -823,6 +823,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
 void
 _mesa_meta_end(struct gl_context *ctx)
 {
+   assert(ctx->Meta->SaveStackDepth > 0);
+
    struct save_state *save = &ctx->Meta->Save[ctx->Meta->SaveStackDepth - 1];
    const GLbitfield state = save->SavedState;
    int i;