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/PathOpsQuadLineIntersectionTest.cpp b/tests/PathOpsQuadLineIntersectionTest.cpp
index 6a9e497..f24b2e4 100644
--- a/tests/PathOpsQuadLineIntersectionTest.cpp
+++ b/tests/PathOpsQuadLineIntersectionTest.cpp
@@ -13,7 +13,7 @@
#include "Test.h"
static struct lineQuad {
- SkDQuad quad;
+ QuadPts quad;
SkDLine line;
int result;
SkDPoint expected[2];
@@ -56,7 +56,7 @@
}
static struct oneLineQuad {
- SkDQuad quad;
+ QuadPts quad;
SkDLine line;
} oneOffs[] = {
{{{{97.9337616,100}, {88,112.94265}, {88,130}}},
@@ -79,7 +79,9 @@
static void testOneOffs(skiatest::Reporter* reporter) {
bool flipped = false;
for (size_t index = 0; index < oneOffs_count; ++index) {
- const SkDQuad& quad = oneOffs[index].quad;
+ const QuadPts& q = oneOffs[index].quad;
+ SkDQuad quad;
+ quad.debugSet(q.fPts);
SkASSERT(ValidQuad(quad));
const SkDLine& line = oneOffs[index].line;
SkASSERT(ValidLine(line));
@@ -106,7 +108,9 @@
DEF_TEST(PathOpsQuadLineIntersection, reporter) {
for (size_t index = 0; index < lineQuadTests_count; ++index) {
int iIndex = static_cast<int>(index);
- const SkDQuad& quad = lineQuadTests[index].quad;
+ const QuadPts& q = lineQuadTests[index].quad;
+ SkDQuad quad;
+ quad.debugSet(q.fPts);
SkASSERT(ValidQuad(quad));
const SkDLine& line = lineQuadTests[index].line;
SkASSERT(ValidLine(line));