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 <shawn.rutledge@qt.io>
bb10
Steffen Kieß 2020-08-24 00:53:00 +02:00
parent f51e6552e3
commit 63bbbdc4b8
1 changed files with 5 additions and 0 deletions

View File

@ -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;