Isabella Bosia : vkd3d-shader: Fix out of bound array accesses.
Alexandre Julliard
julliard at winehq.org
Wed Sep 16 15:30:43 CDT 2020
Module: vkd3d
Branch: master
Commit: cf3388dad7bcf98c01b606f1ceb594894c902dd6
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=cf3388dad7bcf98c01b606f1ceb594894c902dd6
Author: Isabella Bosia <ibosia at codeweavers.com>
Date: Tue Sep 15 18:05:10 2020 +0100
vkd3d-shader: Fix out of bound array accesses.
Signed-off-by: Isabella Bosia <ibosia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/vkd3d-shader/dxbc.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c
index 973a80d..a62974a 100644
--- a/libs/vkd3d-shader/dxbc.c
+++ b/libs/vkd3d-shader/dxbc.c
@@ -1787,7 +1787,13 @@ static void shader_sm4_read_instruction_modifier(DWORD modifier, struct vkd3d_sh
if ((components & 0xfff0) != (components & 0xf) * 0x1110)
FIXME("Components (%#x) have different data types.\n", components);
- ins->resource_data_type = data_type_table[data_type];
+ if (data_type < ARRAY_SIZE(data_type_table))
+ ins->resource_data_type = data_type_table[data_type];
+ else
+ {
+ FIXME("Unhandled data type %#x.\n", data_type);
+ ins->resource_data_type = VKD3D_DATA_FLOAT;
+ }
break;
}
@@ -1796,7 +1802,13 @@ static void shader_sm4_read_instruction_modifier(DWORD modifier, struct vkd3d_sh
enum vkd3d_sm4_resource_type resource_type
= (modifier & VKD3D_SM5_MODIFIER_RESOURCE_TYPE_MASK) >> VKD3D_SM5_MODIFIER_RESOURCE_TYPE_SHIFT;
- ins->resource_type = resource_type_table[resource_type];
+ if (resource_type < ARRAY_SIZE(resource_type_table))
+ ins->resource_type = resource_type_table[resource_type];
+ else
+ {
+ FIXME("Unhandled resource type %#x.\n", resource_type);
+ ins->resource_type = VKD3D_SHADER_RESOURCE_NONE;
+ }
break;
}
More information about the wine-cvs
mailing list