summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-03-19 12:14:08 +0100
committerMarek Olšák <[email protected]>2015-04-23 16:14:39 +0200
commitecc7f2ed910345c4dd0d02ac9c72d69f10ac5572 (patch)
treeef7d98dbcd063783b042259100421b59465eb32a /src/gallium/drivers
parent125574d1effcb3e3eda93f2b2975bc6cc606df3e (diff)
gallium/radeon: don't crash when getting out-of-bounds TEMP references
Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index 18afbcb0a2e..20e506b7c5e 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -191,6 +191,8 @@ emit_fetch(
break;
case TGSI_FILE_TEMPORARY:
+ if (reg->Register.Index >= ctx->temps_count)
+ return LLVMGetUndef(tgsi2llvmtype(bld_base, type));
if (uses_temp_indirect_addressing(bld_base)) {
ptr = lp_get_temp_ptr_soa(bld, reg->Register.Index, swizzle);
break;
@@ -395,6 +397,8 @@ emit_store(
break;
case TGSI_FILE_TEMPORARY:
+ if (range.First + i >= ctx->temps_count)
+ continue;
if (uses_temp_indirect_addressing(bld_base))
temp_ptr = lp_get_temp_ptr_soa(bld, i + range.First, chan_index);
else
@@ -416,6 +420,8 @@ emit_store(
break;
case TGSI_FILE_TEMPORARY:
+ if (reg->Register.Index >= ctx->temps_count)
+ continue;
if (uses_temp_indirect_addressing(bld_base)) {
temp_ptr = NULL;
break;