[Piglit] [PATCH] rendermode-feedback: fix a crash

Marek Olšák maraeo at gmail.com
Sat May 25 00:49:42 UTC 2019


From: Marek Olšák <marek.olsak at amd.com>

For some reason, the last element is uninitialized if I don't clear
the structure like this.
---
 tests/spec/gl-1.0/rendermode-feedback.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/spec/gl-1.0/rendermode-feedback.c b/tests/spec/gl-1.0/rendermode-feedback.c
index 2260370a3..3a46ab4b7 100644
--- a/tests/spec/gl-1.0/rendermode-feedback.c
+++ b/tests/spec/gl-1.0/rendermode-feedback.c
@@ -94,28 +94,27 @@ struct type {
 	  ARRAY_SIZE(gl_4d_color_texture_values) },
 };
 
 static enum piglit_result run_subtest(void * data);
 static const struct piglit_gl_test_config * piglit_config;
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
 	piglit_config = &config;
 
-	struct piglit_subtest tests[ARRAY_SIZE(types) + 1];
+	struct piglit_subtest tests[ARRAY_SIZE(types) + 1] = {};
 	for (unsigned i = 0; i < ARRAY_SIZE(types); ++i) {
 		tests[i].name = piglit_get_gl_enum_name(types[i].type);
 		tests[i].option = tests[i].name;
 		tests[i].subtest_func = run_subtest;
 		tests[i].data = (void *)&types[i];
 	}
-	tests[ARRAY_SIZE(types)] = (struct piglit_subtest){ 0 };
 	config.subtests = tests;
 
 	config.supports_gl_compat_version = 10;
 
 	config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
 	config.khr_no_error_support = PIGLIT_NO_ERRORS;
 
 PIGLIT_GL_TEST_CONFIG_END
 
 static void
-- 
2.17.1



More information about the Piglit mailing list