From 4efcb7d100e824926e03f598d616f6bda5682e14 Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Fri, 2 Feb 2018 15:09:49 -0500 Subject: handle degenerate cubic loops fuzzer generated a cubic with a very tiny loop at one end. Breaking the cubic in two generated a piece so small it was discarded, passing the original along. Instead, use the loop detection as a hint that passing the original may fail further along. Keep the big piece, which is more linear than the original; and change its end to match the original input if the small piece isn't worth keeping. R=kjlubick Bug: skia:7480 Change-Id: If4c5cd46dbf7e16526269f2854e4f2278f427461 Reviewed-on: https://skia-review.googlesource.com/103100 Reviewed-by: Kevin Lubick Commit-Queue: Cary Clark --- src/pathops/SkOpEdgeBuilder.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/pathops') diff --git a/src/pathops/SkOpEdgeBuilder.cpp b/src/pathops/SkOpEdgeBuilder.cpp index 572942dab4..cda6850701 100644 --- a/src/pathops/SkOpEdgeBuilder.cpp +++ b/src/pathops/SkOpEdgeBuilder.cpp @@ -307,6 +307,7 @@ bool SkOpEdgeBuilder::walk() { } if (prior < index) { split->fT[0] = splits[prior].fT[0]; + split->fPts[0] = splits[prior].fPts[0]; } int next = index; int breakLimit = SkTMin(breaks, (int) SK_ARRAY_COUNT(splits) - 1); @@ -315,17 +316,9 @@ bool SkOpEdgeBuilder::walk() { } if (next > index) { split->fT[1] = splits[next].fT[1]; + split->fPts[3] = splits[next].fPts[3]; } if (prior < index || next > index) { - if (0 == split->fT[0] && 1 == split->fT[1]) { - fContourBuilder.addCubic(pointsPtr); - break; - } - SkDCubic part = SkDCubic::SubDivide(pointsPtr, split->fT[0], - split->fT[1]); - if (!part.toFloatPoints(split->fPts)) { - return false; - } split->fVerb = SkReduceOrder::Cubic(split->fPts, split->fReduced); } SkPoint* curve = SkPath::kCubic_Verb == split->fVerb -- cgit v1.2.3