From 2fff8916251000d6077404f5001601f4227ce26d Mon Sep 17 00:00:00 2001 From: Debian Qt/KDE Maintainers Date: Sat, 2 Apr 2022 19:23:38 +0100 Subject: [PATCH] Avoid use-after-free in QXcbConnection::initializeScreens() Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=86b8c5c3f32c2457 Last-Update: 2020-11-23 Gbp-Pq: Name xcb_screens_uaf.patch --- src/plugins/platforms/xcb/qxcbconnection_screens.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp index 9ba71ada3..ec099101f 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp @@ -290,6 +290,8 @@ void QXcbConnection::initializeScreens() // RRGetScreenResources in this case. auto resources_current = Q_XCB_REPLY(xcb_randr_get_screen_resources_current, xcb_connection(), xcbScreen->root); + decltype(Q_XCB_REPLY(xcb_randr_get_screen_resources, + xcb_connection(), xcbScreen->root)) resources; if (!resources_current) { qWarning("failed to get the current screen resources"); } else { @@ -300,8 +302,8 @@ void QXcbConnection::initializeScreens() timestamp = resources_current->config_timestamp; outputs = xcb_randr_get_screen_resources_current_outputs(resources_current.get()); } else { - auto resources = Q_XCB_REPLY(xcb_randr_get_screen_resources, - xcb_connection(), xcbScreen->root); + resources = Q_XCB_REPLY(xcb_randr_get_screen_resources, + xcb_connection(), xcbScreen->root); if (!resources) { qWarning("failed to get the screen resources"); } else { -- 2.30.2