From 472ab81032ccb67a4db295d694ca03d3c75cbda6 Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Tue, 19 Jun 2018 10:47:15 -0400 Subject: 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 Reviewed-by: Mike Reed Commit-Queue: Mike Reed Auto-Submit: Cary Clark --- include/core/SkPathMeasure.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/core/SkPathMeasure.h b/include/core/SkPathMeasure.h index 287c292aeb..e506c42298 100644 --- a/include/core/SkPathMeasure.h +++ b/include/core/SkPathMeasure.h @@ -90,7 +90,9 @@ private: unsigned fFirstPtIndex; // relative to the current contour bool fIsClosed; // relative to the current contour bool fForceClosed; - +#if defined(IS_FUZZING_WITH_LIBFUZZER) + int fSubdivisionsMax; +#endif struct Segment { SkScalar fDistance; // total distance up to this point unsigned fPtIndex; // index into the fPts array -- cgit v1.2.3