From 5537f778a06c73cb98a294fe4d10aa38cb063e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Fri, 16 Sep 2022 16:28:47 +0200 Subject: [PATCH] gallivm: avoid the use of an uninitialized value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When need_derivs is false, lp_build_cube_lookup does not set the value of derivs_out which means that the stack is not initialized but its pointer is then used. Signed-off-by: Corentin Noël Part-of: --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 86680e0d803..64864422a8f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -2559,7 +2559,9 @@ lp_build_sample_common(struct lp_build_sample_context *bld, !bld->static_sampler_state->min_max_lod_equal && !explicit_lod); lp_build_cube_lookup(bld, coords, derivs, &cube_rho, &cube_derivs, need_derivs); - derivs = &cube_derivs; + if (need_derivs) + derivs = &cube_derivs; + if (target == PIPE_TEXTURE_CUBE_ARRAY && !is_lodq) { /* calculate cube layer coord now */ LLVMValueRef layer = lp_build_iround(&bld->coord_bld, coords[3]);