diff --git a/projects/skia/skia.diff b/projects/skia/skia.diff index bd39bfbd5..80df93c6f 100644 --- a/projects/skia/skia.diff +++ b/projects/skia/skia.diff @@ -1,8 +1,25 @@ +diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp +index b22b8ebebb..aec422fa96 100644 +--- a/src/core/SkAAClip.cpp ++++ b/src/core/SkAAClip.cpp +@@ -1630,6 +1630,12 @@ static void operateY(SkAAClip::Builder& builder, const SkAAClip& A, + int topB = iterB.top(); + int botB = iterB.bottom(); + ++#if defined(IS_FUZZING) ++ if ((botA - topA) > 100000 || (botB - topB) > 100000) { ++ return; ++ } ++#endif ++ + do { + const uint8_t* rowA = nullptr; + const uint8_t* rowB = nullptr; diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp -index 478617f828..f4ead536aa 100644 +index 6f8ee30602..d3e7bec831 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp -@@ -1120,6 +1120,12 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint, +@@ -1134,6 +1134,12 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint, // transform the path into device space pathPtr->transform(*matrix, devPathPtr); @@ -64,11 +81,29 @@ index 347e828d0e..dd16dd81a4 100644 if (!SkDraw::DrawToMask(devPath, &clip.getBounds(), this, &matrix, &srcM, SkMask::kComputeBoundsAndRenderImage_CreateMode, style)) { +diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp +index f754c021eb..c6bb36cca6 100644 +--- a/src/core/SkPaint.cpp ++++ b/src/core/SkPaint.cpp +@@ -1492,6 +1492,13 @@ bool SkPaint::getFillPath(const SkPath& src, SkPath* dst, const SkRect* cullRect + + SkStrokeRec rec(*this, resScale); + ++#if defined(IS_FUZZING) ++ // Prevent lines with small widths from timing out. ++ if (rec.getStyle() == SkStrokeRec::Style::kStroke_Style && rec.getWidth() < 0.001) { ++ return false; ++ } ++#endif ++ + const SkPath* srcPtr = &src; + SkPath tmpPath; + diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp -index ab8bf2e1fc..975a849f5d 100644 +index 279615d799..3398961c57 100644 --- a/src/core/SkPath.cpp +++ b/src/core/SkPath.cpp -@@ -3484,7 +3484,11 @@ void SkPathPriv::CreateDrawArcPath(SkPath* path, const SkRect& oval, SkScalar st +@@ -3349,7 +3349,11 @@ void SkPathPriv::CreateDrawArcPath(SkPath* path, const SkRect& oval, SkScalar st SkScalar sweepAngle, bool useCenter, bool isFillNoPathEffect) { SkASSERT(!oval.isEmpty()); SkASSERT(sweepAngle); @@ -155,11 +190,41 @@ index e4e6701cea..c180f417c7 100644 int count = builder.build_edges(path, &clipRect, 0, pathContainedInClip, SkEdgeBuilder::kAnalyticEdge); SkAnalyticEdge** list = builder.analyticEdgeList(); +diff --git a/src/core/SkScan_Hairline.cpp b/src/core/SkScan_Hairline.cpp +index 1f12efefc5..efb5c101ad 100644 +--- a/src/core/SkScan_Hairline.cpp ++++ b/src/core/SkScan_Hairline.cpp +@@ -118,7 +118,11 @@ void SkScan::HairLineRgn(const SkPoint array[], int arrayCount, const SkRegion* + if (ix0 == ix1) {// too short to draw + continue; + } +- ++#if defined(IS_FUZZING) ++ if ((ix0 - ix1) > 100000 || (ix0 - ix1) < 0) { ++ continue; // too big to draw ++ } ++#endif + SkFixed slope = SkFixedDiv(dy, dx); + SkFixed startY = SkFDot6ToFixed(y0) + (slope * ((32 - x0) & 63) >> 6); + +@@ -133,7 +137,11 @@ void SkScan::HairLineRgn(const SkPoint array[], int arrayCount, const SkRegion* + if (iy0 == iy1) { // too short to draw + continue; + } +- ++#if defined(IS_FUZZING) ++ if ((iy0 - iy1) > 100000 || (iy0 - iy1) < 0) { ++ continue; // too big to draw ++ } ++#endif + SkFixed slope = SkFixedDiv(dx, dy); + SkFixed startX = SkFDot6ToFixed(x0) + (slope * ((32 - y0) & 63) >> 6); + diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp -index 6234afe873..54457da0ff 100644 +index 2373e62d46..25b17480c2 100644 --- a/src/core/SkScan_Path.cpp +++ b/src/core/SkScan_Path.cpp -@@ -253,6 +253,11 @@ static void walk_convex_edges(SkEdge* prevHead, SkPath::FillType, +@@ -254,6 +254,11 @@ static void walk_convex_edges(SkEdge* prevHead, SkPath::FillType, } local_top = local_bot + 1; } else { @@ -202,7 +267,7 @@ index 6d89e6f135..680534d384 100644 reader.readPoint(&offset); SkPaint font; diff --git a/src/effects/Sk1DPathEffect.cpp b/src/effects/Sk1DPathEffect.cpp -index 8a74c16cda..f6a5557914 100644 +index 3c1291a0cb..dafdf90dbd 100644 --- a/src/effects/Sk1DPathEffect.cpp +++ b/src/effects/Sk1DPathEffect.cpp @@ -15,6 +15,11 @@ @@ -217,30 +282,6 @@ index 8a74c16cda..f6a5557914 100644 do { SkScalar length = meas.getLength(); SkScalar distance = this->begin(length); -@@ -23,6 +28,11 @@ bool Sk1DPathEffect::filterPath(SkPath* dst, const SkPath& src, - if (delta <= 0) { - break; - } -+#if defined(IS_FUZZING) -+ if (delta <= SK_ScalarNearlyZero) { -+ return false; -+ } -+#endif - distance += delta; - } - } while (meas.nextContour()); -@@ -65,6 +75,11 @@ SkPath1DPathEffect::SkPath1DPathEffect(const SkPath& path, SkScalar advance, - - bool SkPath1DPathEffect::filterPath(SkPath* dst, const SkPath& src, - SkStrokeRec* rec, const SkRect* cullRect) const { -+#if defined(IS_FUZZING) -+ if (dst->countVerbs() > 100 || dst->countPoints() > 100) { -+ return false; -+ } -+#endif - if (fAdvance > 0) { - rec->setFillStyle(); - return this->INHERITED::filterPath(dst, src, rec, cullRect); diff --git a/src/effects/Sk2DPathEffect.cpp b/src/effects/Sk2DPathEffect.cpp index e7ef54b6f7..727aa5221f 100644 --- a/src/effects/Sk2DPathEffect.cpp @@ -322,7 +363,7 @@ index 8a55b13390..e3c78b4e1f 100755 int winding = get_winding(inputPolygonVerts, inputPolygonSize); if (0 == winding) { diff --git a/src/utils/SkShadowTessellator.cpp b/src/utils/SkShadowTessellator.cpp -index 11e8f2d5c6..60963ef288 100755 +index 11e8f2d5c6..70f4cd47c9 100755 --- a/src/utils/SkShadowTessellator.cpp +++ b/src/utils/SkShadowTessellator.cpp @@ -245,6 +245,11 @@ bool SkBaseShadowTessellator::addArc(const SkVector& nextNormal, bool finishArc) @@ -337,3 +378,16 @@ index 11e8f2d5c6..60963ef288 100755 SkVector prevNormal = fPrevOutset; for (int i = 0; i < numSteps-1; ++i) { SkVector currNormal; +@@ -883,6 +888,12 @@ SkSpotShadowTessellator::SkSpotShadowTessellator(const SkPath& path, const SkMat + // compute vectors for clip tests + this->computeClipVectorsAndTestCentroid(); + ++#if defined(IS_FUZZING) ++ // TODO(kjlubick): This may be a bug, remove gate if fixed. ++ if (!SkScalarIsFinite(radius)) { ++ return; ++ } ++#endif + // generate inner ring + if (!SkInsetConvexPolygon(&fPathPolygon[0], fPathPolygon.count(), radius, + &fUmbraPolygon)) {