From 8f5423820a47621cc6c8a903b2e069568970e5f0 Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Mon, 13 Jan 2025 14:27:50 +0100 Subject: [PATCH] vc4: add assertion on constant_fold This fixes an issue detected by static analyzer: the right operand of '>>' is a garbage value due to array index out of bounds. Signed-off-by: Juan A. Suarez Romero Reviewed-by: Jose Maria Casanova Crespo Reviewed-by: Iago Toral Quiroga Part-of: --- src/gallium/drivers/vc4/vc4_opt_constant_folding.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/vc4/vc4_opt_constant_folding.c b/src/gallium/drivers/vc4/vc4_opt_constant_folding.c index 9acbea7bbd3..4d485b2032b 100644 --- a/src/gallium/drivers/vc4/vc4_opt_constant_folding.c +++ b/src/gallium/drivers/vc4/vc4_opt_constant_folding.c @@ -80,6 +80,7 @@ constant_fold(struct vc4_compile *c, struct qinst *inst) uint32_t result = 0; switch (inst->op) { case QOP_SHR: + assert(nsrc == 2); result = ui[0] >> ui[1]; break;