From 37855fd59d18f0f00b47554d08f546cdecafad68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 5 Mar 2021 23:48:00 +0100 Subject: [PATCH] glcpp: Fully initialize struct gl_context valgrind flagged members of gl_ctx->Extensions being used uninitialized: ==23417== Conditional jump or move depends on uninitialised value(s) ==23417== at 0x112642: _glcpp_parser_handle_version_declaration.part.0 (glcpp-parse.y:2493) ==23417== by 0x11A515: glcpp_lex_update_state_per_token (glcpp-lex.l:132) ==23417== by 0x11A515: glcpp_lex (glcpp-lex.l:547) ==23417== by 0x114D46: glcpp_parser_lex (glcpp-parse.y:2302) ==23417== by 0x114D46: glcpp_parser_parse (glcpp-parse.c:1871) ==23417== by 0x11ADC6: glcpp_preprocess (pp.c:238) ==23417== by 0x111384: main (glcpp.c:174) ==23417== Uninitialised value was created by a stack allocation ==23417== at 0x111295: main (glcpp.c:136) Reviewed-by: Dylan Baker Part-of: --- src/compiler/glsl/glcpp/glcpp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/glsl/glcpp/glcpp.c b/src/compiler/glsl/glcpp/glcpp.c index f08b14427f4..b90a46e7769 100644 --- a/src/compiler/glsl/glcpp/glcpp.c +++ b/src/compiler/glsl/glcpp/glcpp.c @@ -102,6 +102,7 @@ load_text_file(void *ctx, const char *filename) static void init_fake_gl_context (struct gl_context *gl_ctx) { + memset(gl_ctx, 0, sizeof(*gl_ctx)); gl_ctx->API = API_OPENGL_COMPAT; gl_ctx->Const.DisableGLSLLineContinuations = false; }