From 63bbbdc4b8dba7be5690065dc6a4ffa5a85b1b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Kie=C3=9F?= Date: Mon, 24 Aug 2020 00:53:00 +0200 Subject: Ignore mouse events where globalPos contains NaN A NaN value in globalPos can cause an endless recursion in QGuiApplicationPrivate::processMouseEvent() when e->enhancedMouseEvent() is true and this is not a move event. When an event contains a NaN in globalPos, print a warning and ignore the event. Pick-to: 5.15 Fixes: QTBUG-86207 Change-Id: I8789e465921789569715e52c98193f91945ea982 Reviewed-by: Shawn Rutledge --- src/gui/kernel/qguiapplication.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 627cf9dba1..2f9349bb55 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2153,6 +2153,11 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo bool mousePress = false; QPointF globalPoint = e->globalPos; + if (qIsNaN(e->globalPos.x()) || qIsNaN(e->globalPos.y())) { + qWarning("QGuiApplicationPrivate::processMouseEvent: Got NaN in mouse position"); + return; + } + if (e->enhancedMouseEvent()) { type = e->buttonType; button = e->button; -- cgit v1.2.3