From 1ef9f6ab2618d1dc1b74fb68169bbbf96c258da0 Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Sat, 31 Aug 2024 00:17:23 +0200 Subject: [PATCH] glcontext/egl: Fix use of uninitialized memory At least some Mesa drivers (see llvmpipe_query_dmabuf_modifiers()) don't initialize the provided external_only array, so some format/modifier combinations could get incorrectly marked as only external. Make sure we zerofill the array before passing it to eglQueryDmaBufModifiersEXT(). Part-of: --- .../gst-plugins-base/gst-libs/gst/gl/egl/gstglcontext_egl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/gl/egl/gstglcontext_egl.c b/subprojects/gst-plugins-base/gst-libs/gst/gl/egl/gstglcontext_egl.c index dfd7baaaeb..0eff87de09 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/gl/egl/gstglcontext_egl.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/gl/egl/gstglcontext_egl.c @@ -1733,11 +1733,12 @@ gst_gl_context_egl_fetch_dma_formats (GstGLContext * context) if (mods_len == 0) { modifiers = g_new (EGLuint64KHR, num_mods); - ext_only = g_new (EGLBoolean, num_mods); + ext_only = g_new0 (EGLBoolean, num_mods); mods_len = num_mods; } else if (mods_len < num_mods) { modifiers = g_renew (EGLuint64KHR, modifiers, num_mods); ext_only = g_renew (EGLBoolean, ext_only, num_mods); + memset (ext_only, 0, num_mods * sizeof (EGLBoolean)); mods_len = num_mods; }