summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2019-04-04 10:53:06 +0200
committerEirik Aavitsland <eirik.aavitsland@qt.io>2019-08-02 10:14:16 +0200
commitf184f8780fef920006cf71e38b1477fe975bc3b1 (patch)
treee39e49b647cae88ee9ad9102169d04a6d124849a
parent8c5a6957fd3121ea2aa81949c746d117e97e1e95 (diff)
Avoid hanging on painting dashed lines with non-finite coordinates
The dash stroker did not check for inf/nan coordinates. Fixes: QTBUG-47887 Change-Id: I1e696cd15cc37d8fcb6a464cac3da33c3a8b95c2 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 8f8267f00bfa0d1716e38358ecc0fafff1d9df14)
-rw-r--r--src/gui/painting/qstroker.cpp4
-rw-r--r--src/gui/painting/qstroker_p.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index 4776545be6..349a88b86b 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -1149,6 +1149,8 @@ void QDashStroker::processCurrentSubpath()
QSubpathFlatIterator it(&m_elements, m_dashThreshold);
qfixed2d prev = it.next();
+ if (!prev.isFinite())
+ return;
bool clipping = !m_clip_rect.isEmpty();
qfixed2d move_to_pos = prev;
@@ -1164,6 +1166,8 @@ void QDashStroker::processCurrentSubpath()
bool hasMoveTo = false;
while (it.hasNext()) {
QStrokerOps::Element e = it.next();
+ if (!qfixed2d(e).isFinite())
+ continue;
Q_ASSERT(e.isLineTo());
cline = QLineF(qt_fixed_to_real(prev.x),
diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h
index 1a7c184e1a..59e4cc6a7b 100644
--- a/src/gui/painting/qstroker_p.h
+++ b/src/gui/painting/qstroker_p.h
@@ -104,6 +104,7 @@ struct qfixed2d
qfixed x;
qfixed y;
+ bool isFinite() { return qIsFinite(x) && qIsFinite(y); }
bool operator==(const qfixed2d &other) const { return qFuzzyCompare(x, other.x)
&& qFuzzyCompare(y, other.y); }
};