Check for zero offsets for PolyUtils
Bug: oss-fuzz:13202 Change-Id: Iee0ec8bdfe6345c91a584607cc499d69d227a919 Reviewed-on: https://skia-review.googlesource.com/c/194422 Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
parent
b8960d0535
commit
2a330e689b
@ -318,6 +318,19 @@ bool SkInsetConvexPolygon(const SkPoint* inputPolygonVerts, int inputPolygonSize
|
||||
return false;
|
||||
}
|
||||
|
||||
// can't inset by a negative or non-finite amount
|
||||
if (inset < -SK_ScalarNearlyZero || !SkScalarIsFinite(inset)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// insetting close to zero just returns the original poly
|
||||
if (inset <= SK_ScalarNearlyZero) {
|
||||
for (int i = 0; i < inputPolygonSize; ++i) {
|
||||
*insetPolygon->push() = inputPolygonVerts[i];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// get winding direction
|
||||
int winding = SkGetPolygonWinding(inputPolygonVerts, inputPolygonSize);
|
||||
if (0 == winding) {
|
||||
@ -1147,6 +1160,14 @@ bool SkOffsetSimplePolygon(const SkPoint* inputPolygonVerts, int inputPolygonSiz
|
||||
return false;
|
||||
}
|
||||
|
||||
// offsetting close to zero just returns the original poly
|
||||
if (SkScalarNearlyZero(offset)) {
|
||||
for (int i = 0; i < inputPolygonSize; ++i) {
|
||||
*offsetPolygon->push() = inputPolygonVerts[i];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// get winding direction
|
||||
int winding = SkGetPolygonWinding(inputPolygonVerts, inputPolygonSize);
|
||||
if (0 == winding) {
|
||||
|
Loading…
Reference in New Issue
Block a user