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-19 16:53:08 +0000 |
commit | 1f3f4965f54856366c065d5ff149e609066ac989 (patch) | |
tree | b6fb50ee51f64db5e45bb46b9ca87c4e26dc52a8 /src/gui | |
parent | 8f6ef542ba7050f39eb9c6062871240a1a62ea42 (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)
Diffstat (limited to 'src/gui')
-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 7622262da9..4ae2c56b39 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -285,6 +285,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; |