<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - eglCreatePlatformWindowSurfaceEXT() should not dereference native_window"
href="https://bugs.freedesktop.org/show_bug.cgi?id=89920">89920</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>eglCreatePlatformWindowSurfaceEXT() should not dereference native_window
</td>
</tr>
<tr>
<th>Product</th>
<td>Mesa
</td>
</tr>
<tr>
<th>Version</th>
<td>10.5
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>EGL
</td>
</tr>
<tr>
<th>Assignee</th>
<td>mesa-dev@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>junkmailnotread@yahoo.com
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>mesa-dev@lists.freedesktop.org
</td>
</tr></table>
<p>
<div>
<pre>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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>