Index: src/pathops/SkPathOpsCubic.cpp |
diff --git a/src/pathops/SkPathOpsCubic.cpp b/src/pathops/SkPathOpsCubic.cpp |
index 7fd3dd235d52762d8fa9514984d18bf7afcb7972..6fcb348e4ff8fdad349989e9ca218ea70437bbcd 100644 |
--- a/src/pathops/SkPathOpsCubic.cpp |
+++ b/src/pathops/SkPathOpsCubic.cpp |
@@ -310,6 +310,7 @@ int SkDCubic::searchRoots(double extremeTs[6], int extrema, double axisIntercept |
extrema += findInflections(&extremeTs[extrema]); |
extremeTs[extrema++] = 0; |
extremeTs[extrema] = 1; |
+ SkASSERT(extrema < 6); |
SkTQSort(extremeTs, extremeTs + extrema); |
int validCount = 0; |
for (int index = 0; index < extrema; ) { |
@@ -320,6 +321,9 @@ int SkDCubic::searchRoots(double extremeTs[6], int extrema, double axisIntercept |
} |
double newT = binarySearch(min, max, axisIntercept, xAxis); |
if (newT >= 0) { |
+ if (validCount >= 3) { |
+ return 0; |
+ } |
validRoots[validCount++] = newT; |
} |
} |