vkd3d-shader/hlsl: Avoid a null pointer dereference in hlsl_block_cleanup (UBSan).

destroy_block() is called with a NULL block from:

* create_loop, through the loop rules for while and do-while loops.
* The selection_statement rule, in the case $6.else_block is NULL.
* free_parse_initializer.
This commit is contained in:
Victor Chiletto 2024-05-06 07:53:14 -03:00 committed by Alexandre Julliard
parent 98f73ca2e5
commit c9af34ab28
Notes: Alexandre Julliard 2024-05-14 23:00:02 +02:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/854

View File

@ -168,6 +168,9 @@ static struct list *make_empty_list(struct hlsl_ctx *ctx)
static void destroy_block(struct hlsl_block *block)
{
if (!block)
return;
hlsl_block_cleanup(block);
vkd3d_free(block);
}