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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6792>
This commit is contained in:
Jakub Adam 2024-08-31 00:17:23 +02:00 committed by Nicolas Dufresne
parent 5b55930db8
commit 1ef9f6ab26

View file

@ -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;
}