Mesa (master): gallivm: Fix trivial out-of-bounds indirection in lp_build_cube_lookup().
Jose Fonseca
jrfonseca at kemper.freedesktop.org
Fri Apr 26 07:45:07 UTC 2013
Module: Mesa
Branch: master
Commit: 542c5b37034a9615924d8b3daf9e23cd11cc1a57
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=542c5b37034a9615924d8b3daf9e23cd11cc1a57
Author: José Fonseca <jfonseca at vmware.com>
Date: Fri Apr 26 08:43:00 2013 +0100
gallivm: Fix trivial out-of-bounds indirection in lp_build_cube_lookup().
Courtesy of clang:
src/gallium/auxiliary/gallivm/lp_bld_sample.c:1483:10: warning: array index of '2' indexes past the end of an array (that contains 2 elements) [-Warray-bounds]
tmp[2] = lp_build_swizzle_aos(coord_bld, ddx_ddy[1], swizzle02);
^ ~
src/gallium/auxiliary/gallivm/lp_bld_sample.c:1430:10: note: array 'tmp' declared here
LLVMValueRef ddx_ddy[2], tmp[2], rho_vec;
^
src/gallium/auxiliary/gallivm/lp_bld_sample.c:1487:56: warning: array index of '2' indexes past the end of an array (that contains 2 elements) [-Warray-bounds]
rho_vec = lp_build_add(coord_bld, rho_vec, tmp[2]);
^ ~
src/gallium/auxiliary/gallivm/lp_bld_sample.c:1430:10: note: array 'tmp' declared here
LLVMValueRef ddx_ddy[2], tmp[2], rho_vec;
^
src/gallium/auxiliary/gallivm/lp_bld_sample.c:1491:56: warning: array index of '2' indexes past the end of an array (that contains 2 elements) [-Warray-bounds]
rho_vec = lp_build_max(coord_bld, rho_vec, tmp[2]);
^ ~
src/gallium/auxiliary/gallivm/lp_bld_sample.c:1430:10: note: array 'tmp' declared here
LLVMValueRef ddx_ddy[2], tmp[2], rho_vec;
^
---
src/gallium/auxiliary/gallivm/lp_bld_sample.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index 33338f6..d689c7b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -1427,7 +1427,7 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld,
ar_ge_as_at = lp_build_cmp(coord_bld, PIPE_FUNC_GEQUAL, ar, maxasat);
if (need_derivs) {
- LLVMValueRef ddx_ddy[2], tmp[2], rho_vec;
+ LLVMValueRef ddx_ddy[2], tmp[3], rho_vec;
static const unsigned char swizzle0[] = { /* no-op swizzle */
0, LP_BLD_SWIZZLE_DONTCARE,
LP_BLD_SWIZZLE_DONTCARE, LP_BLD_SWIZZLE_DONTCARE
More information about the mesa-commit
mailing list