diff options
author | Robert Loehning <robert.loehning@qt.io> | 2020-08-03 15:15:30 +0200 |
---|---|---|
committer | Robert Loehning <robert.loehning@qt.io> | 2020-08-25 10:18:15 +0000 |
commit | 5cbebeda54c81a182b8581a2d0a7f4b6b00e45f8 (patch) | |
tree | e51e7ef8e5c01610520a66f28cba2850006861ff | |
parent | 224f91fb29440b8e0385bc5302ffabcb8f6cfc63 (diff) |
QBezier: Don't try calculating a unit vector when length is null
It's undefined and causes a division by zero.
Fixes: oss-fuzz-24273
Change-Id: I3d34d5c43cccff9255abaf87af265ddea3fe6d95
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 7fa5fdae5c4f4c83acb74ff8cd65eacfa567a727)
Reviewed-by: hjk <hjk@qt.io>
-rw-r--r-- | src/gui/painting/qbezier.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index 65e6063fe4..8964da9d37 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -301,6 +301,8 @@ static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qr QPointF points_shifted[4]; QLineF prev = QLineF(QPointF(), points[1] - points[0]); + if (!prev.length()) + return Discard; QPointF prev_normal = prev.normalVector().unitVector().p2(); points_shifted[0] = points[0] + offset * prev_normal; |