[Piglit] [PATCH] egl-util: zero-init state in egl_util_run to avoid crash on failure

Daniel Kurtz djkurtz at chromium.org
Thu Aug 7 04:12:39 PDT 2014


egl_util_run() does 'goto fail;' on error paths.  The error paths perform
cleanup based on the current values of state's fields.  However, since
state isn't zero-initialized, these fields hold random values in the
error paths, potentially causing crashes.

Signed-off-by: Daniel Kurtz <djkurtz at chromium.org>
---
I do not have commit access, so can someone please submit this for me if it
looks good?
Thanks
-djk

 tests/egl/egl-util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/egl/egl-util.c b/tests/egl/egl-util.c
index 5b36d6d..99d6840 100644
--- a/tests/egl/egl-util.c
+++ b/tests/egl/egl-util.c
@@ -190,7 +190,7 @@ check_extensions(struct egl_state *state, const struct egl_test *test)
 enum piglit_result
 egl_util_run(const struct egl_test *test, int argc, char *argv[])
 {
-	struct egl_state state;
+	struct egl_state state = { 0 };
 	EGLint count;
 	enum piglit_result result = PIGLIT_PASS;
 	int i, dispatch_api, api_bit = EGL_OPENGL_BIT;
-- 
2.0.0.526.g5318336



More information about the Piglit mailing list