Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(493)

Unified Diff: src/pathops/SkOpCoincidence.cpp

Issue 1427913005: path ops: fix fuzz-found divide by zero (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: mark failing test as such Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkOpCoincidence.cpp
diff --git a/src/pathops/SkOpCoincidence.cpp b/src/pathops/SkOpCoincidence.cpp
index 9175e858be46be58e1d715859777e09e7d146201..0d808db4544bbf95fb8d85a412f614b9abfeb75e 100755
--- a/src/pathops/SkOpCoincidence.cpp
+++ b/src/pathops/SkOpCoincidence.cpp
@@ -91,8 +91,14 @@ bool SkOpCoincidence::addExpanded(SkChunkAlloc* allocator
if (!test->ptT()->contains(oTest->ptT())) {
// use t ranges to guess which one is missing
double startRange = coin->fCoinPtTEnd->fT - startPtT->fT;
+ if (!startRange) {
+ return false;
+ }
double startPart = (test->t() - startPtT->fT) / startRange;
double oStartRange = coin->fOppPtTEnd->fT - oStartPtT->fT;
+ if (!oStartRange) {
+ return false;
+ }
double oStartPart = (oTest->t() - oStartPtT->fT) / oStartRange;
if (startPart == oStartPart) {
return false;
« no previous file with comments | « no previous file | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698