Mesa (master): egl_dri2: swrastGetDrawableInfo: set *x, *y [v2]
Emil Velikov
evelikov at kemper.freedesktop.org
Mon Jun 26 11:52:53 UTC 2017
Module: Mesa
Branch: master
Commit: 162c42f8edde4a2c13b1eb5c0f9f0828441ed4c8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=162c42f8edde4a2c13b1eb5c0f9f0828441ed4c8
Author: Ben Crocker <bcrocker at redhat.com>
Date: Thu Jun 22 15:14:51 2017 -0400
egl_dri2: swrastGetDrawableInfo: set *x, *y [v2]
In swrastGetDrawableInfo, set *x and *y, not just *w and *h;
this fixes a crash later in drisw_update_tex_buffer when the
(formerly) uninitialized x and y values are used to construct
an address in a call to llvmpipe_transfer_map.
Fixes crash in Piglit test
"spec at egl 1.4 at eglcreatepbuffersurface and then glclear"
(<piglit dir>/bin/egl-create-pbuffer-surface -auto)
that occurred intermittently, e.g. when the uninitialized x and y in
drisw_update_tex_buffer just happened to contain absurd non-zero values.
v2: Initialize in case if function succeeds or fails, just like *w/*h.
Cc: mesa-stable at lists.freedesktop.org
Signed-off-by: Ben Crocker <bcrocker at redhat.com>
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
---
src/egl/drivers/dri2/platform_x11.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 9176c8e73f..c10cd84fce 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -111,7 +111,7 @@ swrastGetDrawableInfo(__DRIdrawable * draw,
xcb_get_geometry_reply_t *reply;
xcb_generic_error_t *error;
- *w = *h = 0;
+ *x = *y = *w = *h = 0;
cookie = xcb_get_geometry (dri2_dpy->conn, dri2_surf->drawable);
reply = xcb_get_geometry_reply (dri2_dpy->conn, cookie, &error);
if (reply == NULL)
@@ -121,6 +121,8 @@ swrastGetDrawableInfo(__DRIdrawable * draw,
_eglLog(_EGL_WARNING, "error in xcb_get_geometry");
free(error);
} else {
+ *x = reply->x;
+ *y = reply->y;
*w = reply->width;
*h = reply->height;
}
More information about the mesa-commit
mailing list