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>
This commit is contained in:
Robert Loehning 2020-08-03 15:15:30 +02:00
parent 224f91fb29
commit 5cbebeda54

View File

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