diff options
author | Axel Spoerl <axel.spoerl@qt.io> | 2022-04-28 17:03:03 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-04-29 05:34:53 +0000 |
commit | 0e25f1a4da87045eda2b3778456ed9678737420f (patch) | |
tree | 251be0bd79d17ff36e28d3abc90a81ccae0bcca3 /src/plugins | |
parent | f49069f77e50eb1972cc264e8a7e9a3ea432070b (diff) |
Ignore window icon in XCB when its size exceeds maximum request length
When setting a window icon with its data size exceeding
the value returned by xcb_get_maximum_request_length(), the application
fails with XCB error code 4 (Maximum allowed requested length exceeded).
This patch adds a check if icon_data.size() exceeds
xcb_get_maximum_request_length(). If that is the case the icon is being
ignored and a warning is logged.
Fixes: QTBUG-102628
Change-Id: Id47a0833efd16cd29b030e8c880acb416cbc500b
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit ebdaf8ef9cea6f3669fc73bc3395acf2e497f7fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 1d8450a755..0aee383512 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1328,6 +1328,12 @@ void QXcbWindow::setWindowIcon(const QIcon &icon) } if (!icon_data.isEmpty()) { + // Ignore icon exceeding maximum xcb request length + if (icon_data.size() > xcb_get_maximum_request_length(xcb_connection())) { + qWarning("Ignoring window icon: Size %llu exceeds maximum xcb request length %u.", + icon_data.size(), xcb_get_maximum_request_length(xcb_connection())); + return; + } xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, |