diff options
author | caryclark <caryclark@google.com> | 2016-10-20 08:32:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-20 08:32:18 -0700 |
commit | a35ab3e6e024d0b548ded26a2e3b8ecd838ead93 (patch) | |
tree | c009069f86b1129fcf5037ffc8e8fbf1b9ba010f /tests/PathOpsCubicLineIntersectionIdeas.cpp | |
parent | 65820db5e15201a3f30968420232d36c0ca89cd8 (diff) |
fix fuzzers
Many old pathops-related fuzz failures have built up while
the codebase was under a state a flux. Now that the code
is stable, address these failures.
Most of the CL plumbs the debug global state to downstream
routines so that, if the data is not trusted (ala fuzzed)
the function can safely exit without asserting.
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2426173002
Review-Url: https://chromiumcodereview.appspot.com/2426173002
Diffstat (limited to 'tests/PathOpsCubicLineIntersectionIdeas.cpp')
-rw-r--r-- | tests/PathOpsCubicLineIntersectionIdeas.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/PathOpsCubicLineIntersectionIdeas.cpp b/tests/PathOpsCubicLineIntersectionIdeas.cpp index b23dd0ceaf..15554751da 100644 --- a/tests/PathOpsCubicLineIntersectionIdeas.cpp +++ b/tests/PathOpsCubicLineIntersectionIdeas.cpp @@ -16,7 +16,7 @@ static bool gPathOpsCubicLineIntersectionIdeasVerbose = false; static struct CubicLineFailures { - SkDCubic c; + CubicPts c; double t; SkDPoint p; } cubicLineFailures[] = { @@ -145,13 +145,15 @@ DEF_TEST(PathOpsCubicLineRoots, reporter) { double largestR2 = 0; for (int index = 0; index < 1000000000; ++index) { SkDPoint origin = {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)}; - SkDCubic cubic = {{origin, + CubicPts cuPts = {{origin, {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)}, {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)}, {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)} }}; // construct a line at a known intersection double t = ran.nextRangeF(0, 1); + SkDCubic cubic; + cubic.debugSet(cuPts.fPts); SkDPoint pt = cubic.ptAtT(t); // skip answers with no intersections (although note the bug!) or two, or more // see if the line / cubic has a fun range of roots @@ -248,7 +250,9 @@ DEF_TEST(PathOpsCubicLineRoots, reporter) { } static double testOneFailure(const CubicLineFailures& failure) { - const SkDCubic& cubic = failure.c; + const CubicPts& c = failure.c; + SkDCubic cubic; + cubic.debugSet(c.fPts); const SkDPoint& pt = failure.p; double A, B, C, D; SkDCubic::Coefficients(&cubic[0].fY, &A, &B, &C, &D); |