This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository efl.

View the commit online.

commit 5f9c4690da3fbdd851b5bc3f814bbe38036bff0d
Author: Alastair Poole <[email protected]>
AuthorDate: Wed Dec 2 01:57:33 2026 +0000

    evas:gl_common: convert EGL dma-buf modifier flags
    
    EGL writes external-only flags as EGLBoolean values, which are
    wider than the public Eina_Bool elements. Convert the flags before
    copying them to the caller so the query cannot overrun that array.
    
    Co-Authored-By: Codex (GPT-6) <[email protected]>
---
 src/modules/evas/engines/gl_common/evas_gl_api_ext.c | 20 +++++++++++++++++++-
 .../evas/engines/gl_common/evas_gl_api_ext_def.h     |  2 +-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_ext.c b/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
index 9653e5ccb1..4996a047b9 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
@@ -436,8 +436,26 @@ _evgl_evasglQueryDmaBufModifiers(Evas_GL *evas_gl,
                                  int format, int max_modifiers, uint64_t *modifiers, Eina_Bool *external_only, int *num_modifiers)
 {
    EGLDisplay dpy = EGLDISPLAY_GET(evas_gl);
+   EGLBoolean *egl_external_only = NULL;
+   EGLBoolean result;
+   int i;
+
    if (!dpy) return EINA_FALSE;
-   return EXT_FUNC_EGL(eglQueryDmaBufModifiersEXT)(dpy, format, max_modifiers, modifiers, external_only, num_modifiers);
+   /* EGLBoolean is wider than the public Eina_Bool output type. */
+   if (external_only && max_modifiers > 0)
+     {
+        egl_external_only = calloc(max_modifiers, sizeof(*egl_external_only));
+        if (!egl_external_only) return EINA_FALSE;
+     }
+
+   result = EXT_FUNC_EGL(eglQueryDmaBufModifiersEXT)(dpy, format, max_modifiers,
+                                                   modifiers, egl_external_only, num_modifiers);
+   if (result && egl_external_only)
+     for (i = 0; (i < *num_modifiers) && (i < max_modifiers); i++)
+       external_only[i] = egl_external_only[i] != EGL_FALSE;
+
+   free(egl_external_only);
+   return result != EGL_FALSE;
 }
 
 /* Is name one of the space separated tokens of list? Not strstr(): extension
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h b/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h
index f76df528c7..08759d7158 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h
@@ -1682,7 +1682,7 @@ _EVASGL_EXT_BEGIN(EGL_EXT_image_dma_buf_import_modifiers)
         _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(EGLBoolean, eglQueryDmaBufFormatsEXT, (EGLDisplay dpy, int max_formats, int *formats, int *num_formats), (dpy, max_formats, formats, num_formats))
                 _EVASGL_EXT_FUNCTION_DRVFUNC_PROCADDR("eglQueryDmaBufFormatsEXT")
         _EVASGL_EXT_FUNCTION_PRIVATE_END()
-        _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(EGLBoolean, eglQueryDmaBufModifiersEXT, (EGLDisplay dpy, int format, int max_modifiers, uint64_t *modifiers, Eina_Bool *external_only, int *num_modifiers), (dpy, format, max_modifiers, modifiers, external_only, num_modifiers))
+        _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(EGLBoolean, eglQueryDmaBufModifiersEXT, (EGLDisplay dpy, int format, int max_modifiers, uint64_t *modifiers, EGLBoolean *external_only, int *num_modifiers), (dpy, format, max_modifiers, modifiers, external_only, num_modifiers))
                 _EVASGL_EXT_FUNCTION_DRVFUNC_PROCADDR("eglQueryDmaBufModifiersEXT")
         _EVASGL_EXT_FUNCTION_PRIVATE_END()
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to