From: Tim Rowley Date: Wed, 15 Mar 2017 16:42:43 +0000 (-0500) Subject: swr: validate backend state numAttributes X-Git-Tag: upstream/17.1.0~1369 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a7ce0490e42b056dc20e13af795ca3e4cb73ed52;p=platform%2Fupstream%2Fmesa.git swr: validate backend state numAttributes General protection and prevents us from smashing the stack on the first clear state validation (a7b8d50bcb). Fixes crash using icc. Reviewed-by: Bruce Cherniak --- 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 |