Zebediah Figura : vkd3d-shader: Assert that we don't read out of bounds of the base_types array.
Alexandre Julliard
julliard at winehq.org
Tue Mar 2 15:31:17 CST 2021
Module: vkd3d
Branch: master
Commit: 8d444ebbfc37b6f4f6f843e9a4798acb2d82a7a7
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=8d444ebbfc37b6f4f6f843e9a4798acb2d82a7a7
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Sat Feb 27 18:03:11 2021 -0600
vkd3d-shader: Assert that we don't read out of bounds of the base_types array.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/vkd3d-shader/hlsl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
index fbbe001..1d76777 100644
--- a/libs/vkd3d-shader/hlsl.c
+++ b/libs/vkd3d-shader/hlsl.c
@@ -675,14 +675,17 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct vkd3d_string_buffer_cache
switch (type->type)
{
case HLSL_CLASS_SCALAR:
+ assert(type->base_type < ARRAY_SIZE(base_types));
vkd3d_string_buffer_printf(string, "%s", base_types[type->base_type]);
return string;
case HLSL_CLASS_VECTOR:
+ assert(type->base_type < ARRAY_SIZE(base_types));
vkd3d_string_buffer_printf(string, "%s%u", base_types[type->base_type], type->dimx);
return string;
case HLSL_CLASS_MATRIX:
+ assert(type->base_type < ARRAY_SIZE(base_types));
vkd3d_string_buffer_printf(string, "%s%ux%u", base_types[type->base_type], type->dimx, type->dimy);
return string;
More information about the wine-cvs
mailing list