mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 15:30:14 +01:00
egl: extra null checks for get_xcb_screen() return values
verify get_xcb_screen() returned pointer before using it. Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
This commit is contained in:
parent
b9463813ee
commit
4ed23fd590
1 changed files with 24 additions and 6 deletions
|
|
@ -205,6 +205,7 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
|
||||||
xcb_screen_iterator_t s;
|
xcb_screen_iterator_t s;
|
||||||
xcb_generic_error_t *error;
|
xcb_generic_error_t *error;
|
||||||
xcb_drawable_t drawable;
|
xcb_drawable_t drawable;
|
||||||
|
xcb_screen_t *screen;
|
||||||
|
|
||||||
STATIC_ASSERT(sizeof(uintptr_t) == sizeof(native_surface));
|
STATIC_ASSERT(sizeof(uintptr_t) == sizeof(native_surface));
|
||||||
drawable = (uintptr_t) native_surface;
|
drawable = (uintptr_t) native_surface;
|
||||||
|
|
@ -222,11 +223,16 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
|
||||||
|
|
||||||
dri2_surf->region = XCB_NONE;
|
dri2_surf->region = XCB_NONE;
|
||||||
if (type == EGL_PBUFFER_BIT) {
|
if (type == EGL_PBUFFER_BIT) {
|
||||||
|
screen = get_xcb_screen(s, dri2_dpy->screen);
|
||||||
|
if (!screen) {
|
||||||
|
_eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface");
|
||||||
|
goto cleanup_surf;
|
||||||
|
}
|
||||||
|
|
||||||
dri2_surf->drawable = xcb_generate_id(dri2_dpy->conn);
|
dri2_surf->drawable = xcb_generate_id(dri2_dpy->conn);
|
||||||
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
|
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
|
||||||
xcb_create_pixmap(dri2_dpy->conn, conf->BufferSize,
|
xcb_create_pixmap(dri2_dpy->conn, conf->BufferSize,
|
||||||
dri2_surf->drawable,
|
dri2_surf->drawable, screen->root,
|
||||||
get_xcb_screen(s, dri2_dpy->screen)->root,
|
|
||||||
dri2_surf->base.Width, dri2_surf->base.Height);
|
dri2_surf->base.Width, dri2_surf->base.Height);
|
||||||
} else {
|
} else {
|
||||||
dri2_surf->drawable = drawable;
|
dri2_surf->drawable = drawable;
|
||||||
|
|
@ -504,6 +510,7 @@ dri2_x11_connect(struct dri2_egl_display *dri2_dpy)
|
||||||
xcb_dri2_connect_cookie_t connect_cookie;
|
xcb_dri2_connect_cookie_t connect_cookie;
|
||||||
xcb_generic_error_t *error;
|
xcb_generic_error_t *error;
|
||||||
xcb_screen_iterator_t s;
|
xcb_screen_iterator_t s;
|
||||||
|
xcb_screen_t *screen;
|
||||||
char *driver_name, *device_name;
|
char *driver_name, *device_name;
|
||||||
const xcb_query_extension_reply_t *extension;
|
const xcb_query_extension_reply_t *extension;
|
||||||
|
|
||||||
|
|
@ -527,8 +534,12 @@ dri2_x11_connect(struct dri2_egl_display *dri2_dpy)
|
||||||
XCB_DRI2_MINOR_VERSION);
|
XCB_DRI2_MINOR_VERSION);
|
||||||
|
|
||||||
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
|
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
|
||||||
connect_cookie = xcb_dri2_connect_unchecked(dri2_dpy->conn,
|
screen = get_xcb_screen(s, dri2_dpy->screen);
|
||||||
get_xcb_screen(s, dri2_dpy->screen)->root,
|
if (!screen) {
|
||||||
|
_eglError(EGL_BAD_NATIVE_WINDOW, "dri2_x11_connect");
|
||||||
|
return EGL_FALSE;
|
||||||
|
}
|
||||||
|
connect_cookie = xcb_dri2_connect_unchecked(dri2_dpy->conn, screen->root,
|
||||||
XCB_DRI2_DRIVER_TYPE_DRI);
|
XCB_DRI2_DRIVER_TYPE_DRI);
|
||||||
|
|
||||||
xfixes_query =
|
xfixes_query =
|
||||||
|
|
@ -589,12 +600,19 @@ dri2_x11_authenticate(_EGLDisplay *disp, uint32_t id)
|
||||||
xcb_dri2_authenticate_reply_t *authenticate;
|
xcb_dri2_authenticate_reply_t *authenticate;
|
||||||
xcb_dri2_authenticate_cookie_t authenticate_cookie;
|
xcb_dri2_authenticate_cookie_t authenticate_cookie;
|
||||||
xcb_screen_iterator_t s;
|
xcb_screen_iterator_t s;
|
||||||
|
xcb_screen_t *screen;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
|
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
|
||||||
|
|
||||||
|
screen = get_xcb_screen(s, dri2_dpy->screen);
|
||||||
|
if (!screen) {
|
||||||
|
_eglError(EGL_BAD_NATIVE_WINDOW, "dri2_x11_authenticate");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
authenticate_cookie =
|
authenticate_cookie =
|
||||||
xcb_dri2_authenticate_unchecked(dri2_dpy->conn,
|
xcb_dri2_authenticate_unchecked(dri2_dpy->conn, screen->root, id);
|
||||||
get_xcb_screen(s, dri2_dpy->screen)->root, id);
|
|
||||||
authenticate =
|
authenticate =
|
||||||
xcb_dri2_authenticate_reply(dri2_dpy->conn, authenticate_cookie, NULL);
|
xcb_dri2_authenticate_reply(dri2_dpy->conn, authenticate_cookie, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue