Module: Mesa Branch: 9.1 Commit: ebd1f4e069433d8be529b0c0bd9e5bd1b3e12bd9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ebd1f4e069433d8be529b0c0bd9e5bd1b3e12bd9
Author: Marek Olšák <mar...@gmail.com> Date: Fri Jul 19 17:49:54 2013 +0200 r600g: increase array size for shader inputs and outputs and add assertions to prevent buffer overflow. This fixes corruption of the r600_shader struct. NOTE: This is a candidate for the stable branches. (backported from commit da33f9b919039442e9ab51f9b1d1c83a73607133) Conflicts: src/gallium/drivers/r600/r600_shader.c --- src/gallium/drivers/r600/r600_shader.c | 2 ++ src/gallium/drivers/r600/r600_shader.h | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index e0fb18b..9a37916 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -862,6 +862,7 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx) switch (d->Declaration.File) { case TGSI_FILE_INPUT: i = ctx->shader->ninput++; + assert(i < Elements(ctx->shader->input)); ctx->shader->input[i].name = d->Semantic.Name; ctx->shader->input[i].sid = d->Semantic.Index; ctx->shader->input[i].interpolate = d->Interp.Interpolate; @@ -888,6 +889,7 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx) break; case TGSI_FILE_OUTPUT: i = ctx->shader->noutput++; + assert(i < Elements(ctx->shader->output)); ctx->shader->output[i].name = d->Semantic.Name; ctx->shader->output[i].sid = d->Semantic.Index; ctx->shader->output[i].gpr = ctx->file_offset[TGSI_FILE_OUTPUT] + d->Range.First; diff --git a/src/gallium/drivers/r600/r600_shader.h b/src/gallium/drivers/r600/r600_shader.h index f55e002..3b918f9 100644 --- a/src/gallium/drivers/r600/r600_shader.h +++ b/src/gallium/drivers/r600/r600_shader.h @@ -45,8 +45,8 @@ struct r600_shader { unsigned ninput; unsigned noutput; unsigned nlds; - struct r600_shader_io input[32]; - struct r600_shader_io output[32]; + struct r600_shader_io input[40]; + struct r600_shader_io output[40]; boolean uses_kill; boolean fs_write_all; boolean two_side; _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit