From 08253504dcd70530eb89b4a564dc6118022cba68 Mon Sep 17 00:00:00 2001 From: Elizabeth Figura Date: Wed, 23 Oct 2024 16:20:24 -0500 Subject: [PATCH] vkd3d-shader: Make an assert into an explicit check. For some reason gcc without LTO thinks that component_count can overflow the array here. --- libs/vkd3d-shader/spirv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 1bdbd1cc..e3e58557 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -1913,7 +1913,11 @@ static uint32_t vkd3d_spirv_get_type_id(struct vkd3d_spirv_builder *builder, uint32_t scalar_id, type_id; VKD3D_ASSERT(component_type < VKD3D_SHADER_COMPONENT_TYPE_COUNT); - VKD3D_ASSERT(1 <= component_count && component_count <= VKD3D_VEC4_SIZE); + if (!component_count || component_count > VKD3D_VEC4_SIZE) + { + ERR("Invalid component count %u.\n", component_count); + return 0; + } if ((type_id = builder->numeric_type_ids[component_type][component_count - 1])) return type_id;