[Mesa-dev] [Bug 89920] eglCreatePlatformWindowSurfaceEXT() should not dereference native_window

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Apr 6 10:37:58 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=89920

            Bug ID: 89920
           Summary: eglCreatePlatformWindowSurfaceEXT() should not
                    dereference native_window
           Product: Mesa
           Version: 10.5
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: EGL
          Assignee: mesa-dev at lists.freedesktop.org
          Reporter: junkmailnotread at yahoo.com
        QA Contact: mesa-dev at lists.freedesktop.org

The following code block appears in eglCreatePlatformWindowSurfaceEXT() in
src/egl/main/eglapi.c:

#ifdef HAVE_X11_PLATFORM
   if (disp->Platform == _EGL_PLATFORM_X11 && native_window != NULL) {
      /* The `native_window` parameter for the X11 platform differs between
       * eglCreateWindowSurface() and eglCreatePlatformPixmapSurfaceEXT(). In
       * eglCreateWindowSurface(), the type of `native_window` is an Xlib
       * `Window`. In eglCreatePlatformWindowSurfaceEXT(), the type is
       * `Window*`.  Convert `Window*` to `Window` because that's what
       * dri2_x11_create_window_surface() expects.
       */
      native_window = (void*) (* (Window*) native_window);
   }
#endif

The assertion that the `native_window` parameter for the X11 platform differs
between eglCreateWindowSurface() and eglCreatePlatformWindowSurfaceEXT() is not
supported by the EXT_platform_base extension or EGL Version 1.5. These merely
state:

"The behavior of eglCreateWindowSurface is identical to that of
eglCreatePlatformWindowSurfaceEXT except that the set of platforms to which
<dpy> is permitted to belong, as well as the actual type of <win>, are
implementation specific."

Nowhere does it say that - uniquely for the X11 platform - the `native_window`
parameter should be passed by reference rather than by value.

My feeling is that eglCreatePlatformWindowSurfaceEXT() should follow the
behaviour of eglCreateWindowSurface() in treating the `native_window` parameter
as an opaque handle (i.e. EGLNativeWindowType) for all platforms.

A similar situation exists for eglCreatePlatformPixmapSurfaceEXT():

#ifdef HAVE_X11_PLATFORM
      /* The `native_pixmap` parameter for the X11 platform differs between
       * eglCreatePixmapSurface() and eglCreatePlatformPixmapSurfaceEXT(). In
       * eglCreatePixmapSurface(), the type of `native_pixmap` is an Xlib
       * `Pixmap`. In eglCreatePlatformPixmapSurfaceEXT(), the type is
       * `Pixmap*`.  Convert `Pixmap*` to `Pixmap` because that's what
       * dri2_x11_create_pixmap_surface() expects.
       */
   if (disp->Platform == _EGL_PLATFORM_X11 && native_pixmap != NULL) {
      native_pixmap = (void*) (* (Pixmap*) native_pixmap);
   }
#endif

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150406/ca30fd79/attachment.html>


More information about the mesa-dev mailing list