summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Kucera <jkucera@redhat.com>2019-12-01 01:22:19 +0100
committerXinfengZhang <carl.zhang@intel.com>2020-05-25 22:13:41 +0800
commitdeb43699e90c5e0ab46f83bb975cca87a6fe9147 (patch)
treed368f804f533040f20f6436d3c7ed3392ea46e7a
parent0014ada0eb0fd09a0dd928e5a132ecf12ed85c2e (diff)
downloadlibva-deb43699e90c5e0ab46f83bb975cca87a6fe9147.tar.gz
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`.
-rw-r--r--va/glx/va_glx_impl.c4
1 files 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);