aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-05-17 10:11:31 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-17 15:11:13 +0000
commit27575e881ed68ee306d53e94a070c38c5d81e2a6 (patch)
tree56e6ed6839e3fc1934010583633195c11839ff1a /src/utils
parentd2152c4cde9faa06d41f7aa9ced838e82918e7ee (diff)
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>
Diffstat (limited to 'src/utils')
-rwxr-xr-xsrc/utils/SkShadowTessellator.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/utils/SkShadowTessellator.cpp b/src/utils/SkShadowTessellator.cpp
index ee2375ebf2..c377579de2 100755
--- a/src/utils/SkShadowTessellator.cpp
+++ b/src/utils/SkShadowTessellator.cpp
@@ -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;
}