diff options
author | Cary Clark <caryclark@google.com> | 2016-12-08 16:17:56 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-12-08 22:22:12 +0000 |
commit | 59ed482af72beec6812b28d833d8bdf80ba32df7 (patch) | |
tree | 7f993451a2ed6eada726393f3067bae1f2dcfe82 /src/pathops/SkPathOpsTSect.h | |
parent | 8e7432b7f98dd592e529a0c8bb038d73ebfb0478 (diff) |
fix fuzzers
Two crashes and a hang. Abort and return false
in these cases.
TBR=kjlubick@google.com
BUG=skia:5983
Change-Id: I41ac3e56d47ee423b634b2f4886085b9caada76b
Reviewed-on: https://skia-review.googlesource.com/5716
Reviewed-by: Cary Clark <caryclark@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
Diffstat (limited to 'src/pathops/SkPathOpsTSect.h')
-rw-r--r-- | src/pathops/SkPathOpsTSect.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pathops/SkPathOpsTSect.h b/src/pathops/SkPathOpsTSect.h index f3402daa67..5d74c9a998 100644 --- a/src/pathops/SkPathOpsTSect.h +++ b/src/pathops/SkPathOpsTSect.h @@ -1162,6 +1162,7 @@ template<typename TCurve, typename OppCurve> bool SkTSect<TCurve, OppCurve>::deleteEmptySpans() { SkTSpan<TCurve, OppCurve>* test; SkTSpan<TCurve, OppCurve>* next = fHead; + int safetyHatch = 1000; while ((test = next)) { next = test->fNext; if (!test->fBounded) { @@ -1169,6 +1170,9 @@ bool SkTSect<TCurve, OppCurve>::deleteEmptySpans() { return false; } } + if (--safetyHatch < 0) { + return false; + } } return true; } @@ -2234,7 +2238,13 @@ void SkTSect<TCurve, OppCurve>::BinarySearch(SkTSect<TCurve, OppCurve>* sect1, } if (sect1->fActiveCount >= COINCIDENT_SPAN_COUNT && sect2->fActiveCount >= COINCIDENT_SPAN_COUNT) { + if (!sect1->fHead) { + return; + } sect1->computePerpendiculars(sect2, sect1->fHead, sect1->tail()); + if (!sect2->fHead) { + return; + } sect2->computePerpendiculars(sect1, sect2->fHead, sect2->tail()); sect1->removeByPerpendicular(sect2); sect1->validate(); |