mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Avoid leaking blocks on YYABORT.
Currently program errors might result on instructions that use ctx->error_instr as src. In case we hit YYABORT while parsing another part of the HLSL source, we have to make sure that the block that contains the instruction is properly cleaned up, or we might hit the vkd3d:590273:err:hlsl_free_instr Failed assertion: list_empty(&node->uses) assertion when hlsl_ctx_cleanup() is called after the YYABORT. Consider the following shader: float4 main() : sv_target { // Statement A int p = foo; // initializer argument is ERROR. // Statement B undeclared_fun(); // triggers YYABORT. } Statement A will src the ctx->error_instr because of the undeclared identifier and Statement B will trigger an YYABORT because of the undeclared function.
This commit is contained in:
committed by
Henri Verbeet
parent
128688a573
commit
f3ba7a84f4
Notes:
Henri Verbeet
2025-04-16 16:52:17 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1460
@@ -6768,6 +6768,7 @@ static void validate_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim,
|
||||
%type <block> statement_list
|
||||
%type <block> switch_statement
|
||||
%type <block> unary_expr
|
||||
%destructor { destroy_block($$); } <block>
|
||||
|
||||
%type <boolval> boolean
|
||||
|
||||
|
Reference in New Issue
Block a user