mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader: Make an assert into an explicit check.
For some reason gcc without LTO thinks that component_count can overflow the array here.
This commit is contained in:
parent
5883e01032
commit
08253504dc
Notes:
Henri Verbeet
2024-10-28 18:14:14 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1227
@ -1913,7 +1913,11 @@ static uint32_t vkd3d_spirv_get_type_id(struct vkd3d_spirv_builder *builder,
|
|||||||
uint32_t scalar_id, type_id;
|
uint32_t scalar_id, type_id;
|
||||||
|
|
||||||
VKD3D_ASSERT(component_type < VKD3D_SHADER_COMPONENT_TYPE_COUNT);
|
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]))
|
if ((type_id = builder->numeric_type_ids[component_type][component_count - 1]))
|
||||||
return type_id;
|
return type_id;
|
||||||
|
Loading…
Reference in New Issue
Block a user