check path bounds before trying to shadow

Bug: oss-fuzz:8331
Change-Id: Idbff0deb0b9968edf4b4fafd4cf497bbb71c64fa
Reviewed-on: https://skia-review.googlesource.com/128550
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2018-05-17 10:11:31 -04:00 committed by Skia Commit-Bot
parent d2152c4cde
commit 27575e881e

View File

@ -1046,7 +1046,7 @@ void SkSpotShadowTessellator::computeClipAndPathPolygons(const SkPath& path, con
fCentroid.fX += (currPoint.fX + nextPoint.fX) * quadArea;
fCentroid.fY += (currPoint.fY + nextPoint.fY) * quadArea;
fArea += quadArea;
fCentroid *= SK_Scalar1 / (3 * fArea);
fCentroid *= sk_ieee_float_divide(1, 3 * fArea);
}
fCurrClipPoint = fClipPolygon.count() - 1;
@ -1576,7 +1576,7 @@ void SkSpotShadowTessellator::addEdge(const SkPoint& nextPoint, const SkVector&
sk_sp<SkVertices> SkShadowTessellator::MakeAmbient(const SkPath& path, const SkMatrix& ctm,
const SkPoint3& zPlane, bool transparent) {
if (!path.isFinite() || !ctm.isFinite() || !zPlane.isFinite()) {
if (!ctm.mapRect(path.getBounds()).isFinite() || !zPlane.isFinite()) {
return nullptr;
}
SkAmbientShadowTessellator ambientTess(path, ctm, zPlane, transparent);
@ -1586,7 +1586,7 @@ sk_sp<SkVertices> SkShadowTessellator::MakeAmbient(const SkPath& path, const SkM
sk_sp<SkVertices> SkShadowTessellator::MakeSpot(const SkPath& path, const SkMatrix& ctm,
const SkPoint3& zPlane, const SkPoint3& lightPos,
SkScalar lightRadius, bool transparent) {
if (!path.isFinite() || !ctm.isFinite() || !zPlane.isFinite() ||
if (!ctm.mapRect(path.getBounds()).isFinite() || !zPlane.isFinite() ||
!lightPos.isFinite() || !SkScalarIsFinite(lightRadius) || !(lightRadius > 0)) {
return nullptr;
}