[Mesa-dev] [PATCH] swr: validate backend state numAttributes

Cherniak, Bruce bruce.cherniak at intel.com
Wed Mar 15 19:19:38 UTC 2017


Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>

> On Mar 15, 2017, at 11:51 AM, Rowley, Timothy O <timothy.o.rowley at intel.com> wrote:
> 
> General protection, and prevents us from smashing the stack
> on the first clear state validation (a7b8d50bcb).  Fixes crash
> using icc.
> ---
> src/gallium/drivers/swr/swr_state.cpp | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp
> index db214af..2fafabd 100644
> --- a/src/gallium/drivers/swr/swr_state.cpp
> +++ b/src/gallium/drivers/swr/swr_state.cpp
> @@ -1651,6 +1651,8 @@ swr_update_derived(struct pipe_context *pipe,
>    backendState.numAttributes =
>       ((ctx->gs ? ctx->gs->info.base.num_outputs : ctx->vs->info.base.num_outputs) - 1) +
>       (ctx->rasterizer->sprite_coord_enable ? 1 : 0);
> +   backendState.numAttributes = std::min((size_t)backendState.numAttributes,
> +                                         sizeof(backendState.numComponents));
>    for (unsigned i = 0; i < backendState.numAttributes; i++)
>       backendState.numComponents[i] = 4;
>    backendState.constantInterpolationMask = ctx->fs->constantMask |
> -- 
> 2.9.3
> 



More information about the mesa-dev mailing list