Check for count == 0 when computing center of mass.
Bug: oss-fuzz:41243 Change-Id: I0297469057826f83ab35c43733ffb7d3cc5b9965 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/508679 Auto-Submit: Jim Van Verth <jvanverth@google.com> Reviewed-by: Michael Ludwig <michaelludwig@google.com> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
parent
b493da459e
commit
c94eb30c6e
@ -71,6 +71,9 @@ bool center_of_mass(const SegmentArray& segments, SkPoint* c) {
|
||||
SkScalar area = 0;
|
||||
SkPoint center = {0, 0};
|
||||
int count = segments.count();
|
||||
if (count <= 0) {
|
||||
return false;
|
||||
}
|
||||
SkPoint p0 = {0, 0};
|
||||
if (count > 2) {
|
||||
// We translate the polygon so that the first point is at the origin.
|
||||
|
Loading…
Reference in New Issue
Block a user