diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-04-04 10:53:06 +0200 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-04-25 06:06:45 +0000 |
commit | 8f8267f00bfa0d1716e38358ecc0fafff1d9df14 (patch) | |
tree | 4723cf0ea74afa27e4d901406ab8847549da19a2 /src/gui | |
parent | f2b5baf9d0b723b721d9cb7c60a3c04afe904d4f (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>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qstroker.cpp | 4 | ||||
-rw-r--r-- | src/gui/painting/qstroker_p.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp index 292952b7c0..56d0917c6c 100644 --- a/src/gui/painting/qstroker.cpp +++ b/src/gui/painting/qstroker.cpp @@ -1150,6 +1150,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; @@ -1165,6 +1167,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); } }; |