From 04845b60074b6c1fa83bbf26cf9be693bc4f338e Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 23 Sep 2019 22:13:54 +0200 Subject: [PATCH] [wayland] Avoid compare to unintialised value in keyboard repeat Summary: If we get a key event for which if (m_xkb->shouldKeyRepeat(key) && waylandServer()->seat()->keyRepeatDelay() != 0) fails m_key will be unitialised and on release we have a compare against unitialised memory. Won't do any harm, it'll just stop a timer that isn't running, but valgrind complains. 0 is the value QKeyEvent uses when nativeScanCode is unknown so a safe initial values. Reviewers: #kwin, zzag Reviewed By: #kwin, zzag Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D23748 --- keyboard_repeat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboard_repeat.h b/keyboard_repeat.h index 6e9156eadd..7a367c2bd2 100644 --- a/keyboard_repeat.h +++ b/keyboard_repeat.h @@ -47,7 +47,7 @@ private: QTimer *m_timer; Xkb *m_xkb; quint32 m_time; - quint32 m_key; + quint32 m_key = 0; };