From 1662c317032cf280701d7e55b028b7f0dc8afc65 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Sep 2010 15:33:49 -0600 Subject: llvmpipe: check bitshift against PIPE_MAX_SHADER_OUTPUTS --- src/gallium/drivers/llvmpipe/lp_setup_point.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index bb6b88069bf..774a3c80dad 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -188,8 +188,11 @@ setup_point_coefficients( struct lp_setup_context *setup, */ if (shader->info.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) { const int index = shader->info.input_semantic_index[slot]; - - if (setup->sprite_coord_enable & (1 << index)) { + /* Note that sprite_coord enable is a bitfield of + * PIPE_MAX_SHADER_OUTPUTS bits. + */ + if (index < PIPE_MAX_SHADER_OUTPUTS && + (setup->sprite_coord_enable & (1 << index))) { for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) perspective_coef(setup, point, info, slot+1, vert_attr, i, -- cgit v1.2.3