[Mesa-dev] [PATCH 1/5] radeonsi: increase array size for shader inputs and outputs

Marek Olšák maraeo at gmail.com
Fri May 17 08:05:37 PDT 2013


Reviewed-by: Marek Olšák <maraeo at gmail.com>

Marek

On Fri, May 17, 2013 at 11:27 AM, Michel Dänzer <michel at daenzer.net> wrote:
> From: Marek Olšák <maraeo at gmail.com>
>
> and add assertions to prevent buffer overflow. This fixes corruption
> of the si_shader struct.
>
> NOTE: This is a candidate for the 9.1 branch.
>
> [ Cherry-pick of r600g commit da33f9b919039442e9ab51f9b1d1c83a73607133 ]
>
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
> ---
>  src/gallium/drivers/radeonsi/radeonsi_shader.c | 2 ++
>  src/gallium/drivers/radeonsi/radeonsi_shader.h | 4 ++--
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
> index f942436..bea2895 100644
> --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
> +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
> @@ -589,6 +589,7 @@ static void si_llvm_emit_epilogue(struct lp_build_tgsi_context * bld_base)
>                 switch (d->Declaration.File) {
>                 case TGSI_FILE_INPUT:
>                         i = shader->ninput++;
> +                       assert(i < Elements(shader->input));
>                         shader->input[i].name = d->Semantic.Name;
>                         shader->input[i].sid = d->Semantic.Index;
>                         shader->input[i].interpolate = d->Interp.Interpolate;
> @@ -597,6 +598,7 @@ static void si_llvm_emit_epilogue(struct lp_build_tgsi_context * bld_base)
>
>                 case TGSI_FILE_OUTPUT:
>                         i = shader->noutput++;
> +                       assert(i < Elements(shader->output));
>                         shader->output[i].name = d->Semantic.Name;
>                         shader->output[i].sid = d->Semantic.Index;
>                         shader->output[i].interpolate = d->Interp.Interpolate;
> diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.h b/src/gallium/drivers/radeonsi/radeonsi_shader.h
> index 1552dc2..0fbd601 100644
> --- a/src/gallium/drivers/radeonsi/radeonsi_shader.h
> +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.h
> @@ -101,10 +101,10 @@ struct si_pipe_shader_selector {
>
>  struct si_shader {
>         unsigned                ninput;
> -       struct si_shader_io     input[32];
> +       struct si_shader_io     input[40];
>
>         unsigned                noutput;
> -       struct si_shader_io     output[32];
> +       struct si_shader_io     output[40];
>
>         unsigned                ninterp;
>         bool                    uses_kill;
> --
> 1.8.3.rc1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list