From: Yeongjin Jeong Date: Fri, 9 Aug 2019 09:43:06 +0000 (+0900) Subject: vulkan/xcb: Don't try to create xcb window with non-xcb display X-Git-Tag: 1.19.3~507^2~2898 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=94671be428212d87e3c781a248e373ef8e2bfa73;p=platform%2Fupstream%2Fgstreamer.git vulkan/xcb: Don't try to create xcb window with non-xcb display Non-xcb display does not have a xcb_connection and trying to create xcb window with wild pointer can cause segfault. --- diff --git a/gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.c b/gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.c index 047c276..fb32e97 100644 --- a/gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.c +++ b/gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.c @@ -271,9 +271,17 @@ static gboolean gst_vulkan_window_xcb_open (GstVulkanWindow * window, GError ** error) { GstVulkanWindowXCB *window_xcb = GST_VULKAN_WINDOW_XCB (window); - GstVulkanDisplayXCB *display_xcb = (GstVulkanDisplayXCB *) window->display; + GstVulkanDisplayXCB *display_xcb; xcb_connection_t *connection; + if (!GST_IS_VULKAN_DISPLAY_XCB (window->display)) { + g_set_error (error, GST_VULKAN_WINDOW_ERROR, + GST_VULKAN_WINDOW_ERROR_RESOURCE_UNAVAILABLE, + "Cannot create an XCB window from a non-XCB display"); + goto failure; + } + + display_xcb = GST_VULKAN_DISPLAY_XCB (window->display); connection = GST_VULKAN_DISPLAY_XCB_CONNECTION (display_xcb); if (connection == NULL) { g_set_error (error, GST_VULKAN_WINDOW_ERROR,