Mesa (master): ac: fix buffer overflow bug in 64bit SSBO loads

Timothy Arceri tarceri at kemper.freedesktop.org
Wed Jan 17 23:27:35 UTC 2018


Module: Mesa
Branch: master
Commit: e2b9296146746635cd631c5212ae56f0cd270820
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e2b9296146746635cd631c5212ae56f0cd270820

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Tue Jan 16 17:45:30 2018 +1100

ac: fix buffer overflow bug in 64bit SSBO loads

Fixes: 441ee1e65b04 "radv/ac: Implement Float64 SSBO loads"

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/amd/common/ac_nir_to_llvm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 1dc64f87cc..e07330ca5c 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -2588,8 +2588,11 @@ static LLVMValueRef visit_load_buffer(struct ac_nir_context *ctx,
 			ctx->ac.i1false,
 		};
 
-		results[i] = ac_build_intrinsic(&ctx->ac, load_name, data_type, params, 5, 0);
+		int idx = i;
+		if (instr->dest.ssa.bit_size == 64)
+			idx = i > 1 ? 1 : 0;
 
+		results[idx] = ac_build_intrinsic(&ctx->ac, load_name, data_type, params, 5, 0);
 	}
 
 	assume(results[0]);




More information about the mesa-commit mailing list