Mesa (master): egl/x11: handle when invalid drawable is passed in create_surface
Emil Velikov
evelikov at kemper.freedesktop.org
Tue Jun 30 16:32:02 UTC 2015
Module: Mesa
Branch: master
Commit: af2aea40d29dffd5e584432e0652db114113469b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=af2aea40d29dffd5e584432e0652db114113469b
Author: Emil Velikov <emil.l.velikov at gmail.com>
Date: Thu Jun 18 20:39:28 2015 +0100
egl/x11: handle when invalid drawable is passed in create_surface
0 is not used as a valid drawable id, as such there is no point in
attempting to query its geometry. Just bail out early and provide the
more meaningful EGL_BAD_NATIVE_WINDOW to the user.
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
src/egl/drivers/dri2/platform_x11.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 0fbf4e4..ad40bd5 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -235,6 +235,10 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
dri2_surf->drawable, screen->root,
dri2_surf->base.Width, dri2_surf->base.Height);
} else {
+ if (!drawable) {
+ _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface");
+ goto cleanup_surf;
+ }
dri2_surf->drawable = drawable;
}
More information about the mesa-commit
mailing list