Module: vkd3d Branch: master Commit: ac9b14599f527495538d39e6a0e54bdb95d1f9b2 URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/ac9b14599f527495538d39e6a0e54b...
Author: Conor McCarthy cmccarthy@codeweavers.com Date: Fri Jan 12 00:09:56 2024 +1000
vkd3d-shader/dxil: Avoid null dereference on failure to find function pointer type.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55684
---
libs/vkd3d-shader/dxil.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index c744dfce..869a709d 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -2331,8 +2331,8 @@ static const struct sm6_value *sm6_parser_get_value_by_ref(struct sm6_parser *sm
static bool sm6_parser_declare_function(struct sm6_parser *sm6, const struct dxil_record *record) { + const struct sm6_type *type, *ret_type; const unsigned int max_count = 15; - const struct sm6_type *ret_type; struct sm6_value *fn; unsigned int i, j;
@@ -2347,18 +2347,18 @@ static bool sm6_parser_declare_function(struct sm6_parser *sm6, const struct dxi fn->u.function.name = ""; }
- if (!(fn->type = sm6_parser_get_type(sm6, record->operands[0]))) + if (!(type = sm6_parser_get_type(sm6, record->operands[0]))) return false; - if (!sm6_type_is_function(fn->type)) + if (!sm6_type_is_function(type)) { WARN("Type is not a function.\n"); return false; } - ret_type = fn->type->u.function->ret_type; + ret_type = type->u.function->ret_type;
- if (!(fn->type = sm6_type_get_pointer_to_type(fn->type, ADDRESS_SPACE_DEFAULT, sm6))) + if (!(fn->type = sm6_type_get_pointer_to_type(type, ADDRESS_SPACE_DEFAULT, sm6))) { - WARN("Failed to get pointer type for type %u.\n", fn->type->class); + WARN("Failed to get pointer type for type %u.\n", type->class); return false; }