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
diff --git a/tests/PathOpsCubicLineIntersectionTest.cpp b/tests/PathOpsCubicLineIntersectionTest.cpp
index a2b870d..a6ae5e6 100644
--- a/tests/PathOpsCubicLineIntersectionTest.cpp
+++ b/tests/PathOpsCubicLineIntersectionTest.cpp
@@ -12,7 +12,7 @@
#include "Test.h"
struct lineCubic {
- SkDCubic cubic;
+ CubicPts cubic;
SkDLine line;
};
@@ -25,7 +25,9 @@
static const size_t failLineCubicTests_count = SK_ARRAY_COUNT(failLineCubicTests);
static void testFail(skiatest::Reporter* reporter, int iIndex) {
- const SkDCubic& cubic = failLineCubicTests[iIndex].cubic;
+ const CubicPts& cuPts = failLineCubicTests[iIndex].cubic;
+ SkDCubic cubic;
+ cubic.debugSet(cuPts.fPts);
SkASSERT(ValidCubic(cubic));
const SkDLine& line = failLineCubicTests[iIndex].line;
SkASSERT(ValidLine(line));
@@ -123,7 +125,9 @@
}
static void testOne(skiatest::Reporter* reporter, int iIndex) {
- const SkDCubic& cubic = lineCubicTests[iIndex].cubic;
+ const CubicPts& cuPts = lineCubicTests[iIndex].cubic;
+ SkDCubic cubic;
+ cubic.debugSet(cuPts.fPts);
SkASSERT(ValidCubic(cubic));
const SkDLine& line = lineCubicTests[iIndex].line;
SkASSERT(ValidLine(line));
@@ -188,7 +192,9 @@
DEF_TEST(PathOpsCubicLineIntersectionOneOff, reporter) {
int iIndex = 0;
testOne(reporter, iIndex);
- const SkDCubic& cubic = lineCubicTests[iIndex].cubic;
+ const CubicPts& cuPts = lineCubicTests[iIndex].cubic;
+ SkDCubic cubic;
+ cubic.debugSet(cuPts.fPts);
const SkDLine& line = lineCubicTests[iIndex].line;
SkIntersections i;
i.intersect(cubic, line);