From deb43699e90c5e0ab46f83bb975cca87a6fe9147 Mon Sep 17 00:00:00 2001 From: Jiri Kucera Date: Sun, 1 Dec 2019 01:22:19 +0100 Subject: Fix clang warning (reading garbage) In function `vaCopySurfaceGLX_impl_libva`, if `pSurfaceGLX->gl_context` points to `struct OpenGLContextState` memory object with all its members set to 0, the first call of `gl_set_current_context` returns true without setting the `old_cs`. Then, in the following next call of `gl_set_current_context`, `&old_cs` will point to random data on the stack. Similarly for `vaDestroySurfaceGLX_impl_libva`. --- va/glx/va_glx_impl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/va/glx/va_glx_impl.c b/va/glx/va_glx_impl.c index 23ea270..a3c7697 100644 --- a/va/glx/va_glx_impl.c +++ b/va/glx/va_glx_impl.c @@ -939,7 +939,7 @@ static VAStatus vaDestroySurfaceGLX_impl_libva(VADriverContextP ctx, void *gl_surface) { VASurfaceGLXP pSurfaceGLX; - struct OpenGLContextState old_cs, *new_cs; + struct OpenGLContextState old_cs = {0}, *new_cs; INIT_SURFACE(pSurfaceGLX, gl_surface); @@ -1072,7 +1072,7 @@ vaCopySurfaceGLX_impl_libva( { VASurfaceGLXP pSurfaceGLX; VAStatus status; - struct OpenGLContextState old_cs; + struct OpenGLContextState old_cs = {0}; INIT_SURFACE(pSurfaceGLX, gl_surface); -- cgit v1.2.1