From 2e82f481ca956252c86b08da2ba46e9449d8bf0f Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Mon, 26 May 2025 18:03:15 +0100 Subject: [PATCH] radv: fix too large shift exponent in radv_remove_color_exports "shift exponent 1020 is too large for 32-bit type 'unsigned int'" with madmax/25b8180e05220b8c and UBSan Signed-off-by: Rhys Perry Reviewed-by: Georg Lehmann Part-of: --- src/amd/vulkan/radv_pipeline_graphics.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index c23a8323ebd..02b8a631c5f 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -1101,7 +1101,9 @@ radv_remove_color_exports(const struct radv_graphics_state_key *gfx_state, nir_s continue; const uint8_t cb_idx = color_remap[idx]; - unsigned col_format = (gfx_state->ps.epilog.spi_shader_col_format >> (4 * cb_idx)) & 0xf; + unsigned col_format = cb_idx == MESA_VK_ATTACHMENT_UNUSED + ? V_028714_SPI_SHADER_ZERO + : (gfx_state->ps.epilog.spi_shader_col_format >> (4 * cb_idx)) & 0xf; if (col_format == V_028714_SPI_SHADER_ZERO) { /* Remove the color export if it's unused or in presence of holes. */