diff options
author | Tim Rowley <[email protected]> | 2017-03-15 11:42:43 -0500 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2017-03-15 15:08:59 -0500 |
commit | a7ce0490e42b056dc20e13af795ca3e4cb73ed52 (patch) | |
tree | c2317f88b7434e52b5b07168b1803804138673b2 /src | |
parent | 8378c576abd3b84aacfa854c9d110c36f10ac6a2 (diff) |
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/swr/swr_state.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index db214af9936..2fafabd80ee 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 | |