summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbclipboard.cpp
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@qt.io>2017-03-01 14:29:25 +0100
committerGatis Paeglis <gatis.paeglis@qt.io>2017-03-01 15:15:18 +0000
commit1a5deb7e0ea9a129d4ebc59677893c7477ad5a3a (patch)
tree6469b0e9ec0ead0cb5f4aa15e155d2cb1c567b3a /src/plugins/platforms/xcb/qxcbclipboard.cpp
parentfe2ab724de8bf9bef92f2e889efd6546ac828743 (diff)
xcb: fix misuse of xcb_send_event
This fixes the following Valgrind warning: "Syscall param writev(vector[...]) points to uninitialised byte(s) Uninitialised value was created by a stack allocation" The xcb_send_event() requires all events to have 32 bytes. It calls memcpy() on the passed in event. If the passed in event is less than 32 bytes, memcpy() reaches into unrelated memory. And as it turns out, this behavior is actually described in the xcb_send_event function's documentation. This patch adds a macro that declares an event for safe usage with xcb_send_event. Change-Id: Ifcaab5e9a3b52b7f64ac930b423e0c7798bbfedb Done-with: Uli Schlachter Task-number: QTBUG-56518 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbclipboard.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index cee011bbdf..a293066b93 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -607,7 +607,7 @@ void QXcbClipboard::handleSelectionRequest(xcb_selection_request_event_t *req)
return;
}
- xcb_selection_notify_event_t event;
+ Q_DECLARE_XCB_EVENT(event, xcb_selection_notify_event_t);
event.response_type = XCB_SELECTION_NOTIFY;
event.requestor = req->requestor;
event.selection = req->selection;