Module: vkd3d Branch: master Commit: b35fd8628e2bfb2d448cc0671a210217fe8c19e1 URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=b35fd8628e2bfb2d448cc067...
Author: Zebediah Figura zfigura@codeweavers.com Date: Thu Mar 4 17:33:25 2021 -0600
vkd3d-shader: Watch for allocation failure from yyparse().
Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
libs/vkd3d-shader/hlsl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 02fa484..19bfc93 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -1646,7 +1646,11 @@ int hlsl_compile_shader(const char *text, const struct vkd3d_shader_compile_info if (!hlsl_ctx_init(&ctx, message_context)) return VKD3D_ERROR_OUT_OF_MEMORY;
- hlsl_lexer_compile(&ctx, text); + if (hlsl_lexer_compile(&ctx, text) == 2) + { + hlsl_ctx_cleanup(&ctx); + return VKD3D_ERROR_OUT_OF_MEMORY; + }
if (ctx.failed) {