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>
This commit is contained in:
Eirik Aavitsland 2019-04-04 10:53:06 +02:00
parent f2b5baf9d0
commit 8f8267f00b
2 changed files with 5 additions and 0 deletions

View File

@ -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),

View File

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