aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2018-06-19 10:47:15 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-21 16:42:37 +0000
commit472ab81032ccb67a4db295d694ca03d3c75cbda6 (patch)
tree72de4eb3328cb0cb6336c42f241865bfbda47fb6 /src/effects
parent9ffe3dc24560297982002234c3e3a03a941f46a9 (diff)
abort really big path fuzzing
This adds a couple of special cases to stop the fuzzer from timing out. The first occurs when the fuzzer generates a very large path with very large quads. Count the subdivisions and stop after a while. The second occurs with a normal path and 1D path effect with a very small advance. Count the points and stop after a while. R=reed@google.com,bsalomon@google.com,kjlubick@google.com Bug: oss-fuzz:8349,oss-fuzz:8805 Change-Id: I86130e3f512f48e5a39335412435eabc245ed193 Reviewed-on: https://skia-review.googlesource.com/135709 Reviewed-by: Kevin Lubick <kjlubick@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com> Auto-Submit: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/Sk1DPathEffect.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/effects/Sk1DPathEffect.cpp b/src/effects/Sk1DPathEffect.cpp
index 1837479147..bad6ced508 100644
--- a/src/effects/Sk1DPathEffect.cpp
+++ b/src/effects/Sk1DPathEffect.cpp
@@ -171,6 +171,11 @@ void SkPath1DPathEffect::flatten(SkWriteBuffer& buffer) const {
SkScalar SkPath1DPathEffect::next(SkPath* dst, SkScalar distance,
SkPathMeasure& meas) const {
+#if defined(IS_FUZZING_WITH_LIBFUZZER)
+ if (dst->countPoints() > 100000) {
+ return fAdvance;
+ }
+#endif
switch (fStyle) {
case kTranslate_Style: {
SkPoint pos;