From: Debian Qt/KDE Maintainers Date: Mon, 21 Feb 2022 21:00:28 +0000 (+0000) Subject: Avoid use-after-free in QXcbConnection::initializeScreens() X-Git-Tag: archive/raspbian/5.15.2+dfsg-15+rpi1^2~29 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=dcb5bab5557503e25d78d9c3f9352cf7fe2ff1e8;p=qtbase-opensource-src.git 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 --- 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 {