fix path ops fuzz bug
If one path is empty and the other has extreme values, the
intermediate coincident paths cannot be resolved, but triggers
an assert that a data structure unexpectedly has zero-length.
Tunnel this failure back up to the top and return that the
entire path op fails.
A future optimization could detect the empty path and avoid
this, allowing the op to succeed -- not sure that it's worth
the additional logic though.
TBR=reed@google.com
BUG=535151
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1730293002
Review URL: https://codereview.chromium.org/1730293002
diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp
index 7639cd9..7de910c 100644
--- a/tests/PathOpsOpTest.cpp
+++ b/tests/PathOpsOpTest.cpp
@@ -5564,6 +5564,18 @@
}
}
+static void fuzz535151(skiatest::Reporter* reporter, const char* filename) {
+ SkPath one;
+ one.setFillType(SkPath::kWinding_FillType);
+ SkPath two;
+ two.setFillType(SkPath::kWinding_FillType);
+ two.moveTo(0, 0);
+ two.lineTo(0, 50);
+ two.lineTo(4.29497e+09f, 50);
+ SkPath dummy;
+ REPORTER_ASSERT(reporter, !Op(one, two, kIntersect_SkPathOp, &dummy));
+}
+
static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.addRect(0,0, 300,170141183460469231731687303715884105728.f);
@@ -5781,6 +5793,7 @@
}
static struct TestDesc failTests[] = {
+ TEST(fuzz535151),
TEST(fuzz753_91),
TEST(fuzz714),
TEST(fuzz487a),