fix fuzz bug

TBR=reed@google.com
BUG=637968, 638002
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2250573003

Review-Url: https://codereview.chromium.org/2250573003
This commit is contained in:
caryclark 2016-08-16 10:25:29 -07:00 committed by Commit bot
parent 3287588a46
commit a1b42d91a5
3 changed files with 88 additions and 3 deletions

View File

@ -694,7 +694,7 @@ bool SkOpCoincidence::addOrOverlap(SkOpSegment* coinSeg, SkOpSegment* oppSeg,
: coinSeg->addT(coinTs, SkOpSegment::kNoAliasMatch, nullptr);
SkOpPtT* osWritable = os ? const_cast<SkOpPtT*>(os)
: oppSeg->addT(oppTs, SkOpSegment::kNoAliasMatch, nullptr);
if (!osWritable) {
if (!csWritable || !osWritable) {
return false;
}
csWritable->span()->addOppAndMerge(osWritable->span());

View File

@ -1159,7 +1159,7 @@ SkTSpan<TCurve, OppCurve>* SkTSect<TCurve, OppCurve>::extractCoincident(
SkTSect<OppCurve, TCurve>* sect2,
SkTSpan<TCurve, OppCurve>* first, SkTSpan<TCurve, OppCurve>* last) {
first = findCoincidentRun(first, &last);
if (!first) {
if (!first || !last) {
return nullptr;
}
// march outwards to find limit of coincidence from here to previous and next spans

View File

@ -7196,9 +7196,94 @@ path.cubicTo(SkBits2Float(0x9e9e9e9e), SkBits2Float(0xe8009e9e), SkBits2Float(0x
testPathOpSkipAssert(reporter, path1, path2, (SkPathOp) 2, filename);
}
static void fuzz763_25(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType((SkPath::FillType) 1);
path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x6a4b7bc4)); // 0, 6.14991e+25f
path.conicTo(SkBits2Float(0x653140d9), SkBits2Float(0x6a4b4f74), SkBits2Float(0x65906630), SkBits2Float(0x6a25a070), SkBits2Float(0x3f6728a2)); // 5.23159e+22f, 6.14468e+25f, 8.52382e+22f, 5.00576e+25f, 0.902964f
path.cubicTo(SkBits2Float(0x68295bc5), SkBits2Float(0x00000000), SkBits2Float(0x682958ff), SkBits2Float(0x00000000), SkBits2Float(0x68286829), SkBits2Float(0x00000000)); // 3.19909e+24f, 0, 3.19889e+24f, 0, 3.18112e+24f, 0
path.lineTo(SkBits2Float(0x68555b29), SkBits2Float(0x00000000)); // 4.03018e+24f, 0
path.conicTo(SkBits2Float(0x00000000), SkBits2Float(0x682d2927), SkBits2Float(0x00000000), SkBits2Float(0x00000000), SkBits2Float(0x6829686f)); // 0, 3.27091e+24f, 0, 0, 3.20003e+24f
path.lineTo(SkBits2Float(0xdf218a28), SkBits2Float(0x00000000)); // -1.16402e+19f, 0
path.lineTo(SkBits2Float(0x00000000), SkBits2Float(0x6a4b7bc4)); // 0, 6.14991e+25f
path.close();
path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0
path.conicTo(SkBits2Float(0x6642c40c), SkBits2Float(0x00000000), SkBits2Float(0x65906630), SkBits2Float(0x6a25a070), SkBits2Float(0x3edcd74d)); // 2.29939e+23f, 0, 8.52382e+22f, 5.00576e+25f, 0.43133f
path.conicTo(SkBits2Float(0x68295afa), SkBits2Float(0x00000000), SkBits2Float(0x00000000), SkBits2Float(0x00000000), SkBits2Float(0x4277a57b)); // 3.19903e+24f, 0, 0, 0, 61.9116f
path.close();
SkPath path1(path);
path.reset();
path.setFillType((SkPath::FillType) 0);
SkPath path2(path);
testPathOpSkipAssert(reporter, path1, path2, (SkPathOp) 4, filename);
}
static void fuzz763_26(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType((SkPath::FillType) 0);
SkPath path1(path);
path.reset();
path.setFillType((SkPath::FillType) 0);
path.moveTo(SkBits2Float(0x68556829), SkBits2Float(0x555b2d29)); // 4.03114e+24f, 1.50617e+13f
path.moveTo(SkBits2Float(0x1f2a312a), SkBits2Float(0xc003210a)); // 3.60396e-20f, -2.04889f
path.cubicTo(SkBits2Float(0x68372d55), SkBits2Float(0xf05b684b), SkBits2Float(0x8c55272d), SkBits2Float(0x212a292a), SkBits2Float(0x0321082a), SkBits2Float(0x6a4b7bc0)); // 3.46012e+24f, -2.71613e+29f, -1.64207e-31f, 5.76527e-19f, 4.7323e-37f, 6.14991e+25f
path.conicTo(SkBits2Float(0x212a8ced), SkBits2Float(0x0321081f), SkBits2Float(0x6a4b7bc0), SkBits2Float(0x2829ed84), SkBits2Float(0x69555b2d)); // 5.77848e-19f, 4.7323e-37f, 6.14991e+25f, 9.43289e-15f, 1.61207e+25f
path.moveTo(SkBits2Float(0x68315b2d), SkBits2Float(0xf0682955)); // 3.35016e+24f, -2.87402e+29f
path.conicTo(SkBits2Float(0x212a1f5b), SkBits2Float(0x8cef552a), SkBits2Float(0x295b2d2a), SkBits2Float(0x68210368), SkBits2Float(0x7bc05508)); // 5.76397e-19f, -3.6875e-31f, 4.86669e-14f, 3.04146e+24f, 1.99729e+36f
path.lineTo(SkBits2Float(0x68315b2d), SkBits2Float(0xf0682955)); // 3.35016e+24f, -2.87402e+29f
path.close();
path.moveTo(SkBits2Float(0x68315b2d), SkBits2Float(0xf0682955)); // 3.35016e+24f, -2.87402e+29f
path.lineTo(SkBits2Float(0x5b2c6829), SkBits2Float(0x212a8c55)); // 4.85282e+16f, 5.7784e-19f
path.moveTo(SkBits2Float(0x0321081f), SkBits2Float(0x6a4b7bc0)); // 4.7323e-37f, 6.14991e+25f
path.conicTo(SkBits2Float(0x68385b2d), SkBits2Float(0x555bf055), SkBits2Float(0x2a1f2a8c), SkBits2Float(0x03212121), SkBits2Float(0x5a4b7bc0)); // 3.48239e+24f, 1.51141e+13f, 1.41368e-13f, 4.73517e-37f, 1.43189e+16f
path.conicTo(SkBits2Float(0xc08c2aed), SkBits2Float(0x211f2108), SkBits2Float(0x6a4b7b03), SkBits2Float(0x6829ed27), SkBits2Float(0x2d555b2d)); // -4.38024f, 5.3915e-19f, 6.14982e+25f, 3.20982e+24f, 1.21279e-11f
path.moveTo(SkBits2Float(0x68355b2d), SkBits2Float(0xf0685527)); // 3.42572e+24f, -2.87614e+29f
path.conicTo(SkBits2Float(0x2a8c555b), SkBits2Float(0x6e2a1f72), SkBits2Float(0x0321082a), SkBits2Float(0x6a4b7bc0), SkBits2Float(0x4793ed7a)); // 2.49282e-13f, 1.31626e+28f, 4.7323e-37f, 6.14991e+25f, 75739
path.lineTo(SkBits2Float(0x68355b2d), SkBits2Float(0xf0685527)); // 3.42572e+24f, -2.87614e+29f
path.close();
path.moveTo(SkBits2Float(0x68355b2d), SkBits2Float(0xf0685527)); // 3.42572e+24f, -2.87614e+29f
path.quadTo(SkBits2Float(0x2128282a), SkBits2Float(0x3a8a3adf), SkBits2Float(0x8a284f1a), SkBits2Float(0x2c213ab3)); // 5.69738e-19f, 0.00105461f, -8.10378e-33f, 2.29121e-12f
path.lineTo(SkBits2Float(0x68355b2d), SkBits2Float(0xf0685527)); // 3.42572e+24f, -2.87614e+29f
path.close();
path.moveTo(SkBits2Float(0x68355b2d), SkBits2Float(0xf0685527)); // 3.42572e+24f, -2.87614e+29f
path.quadTo(SkBits2Float(0x1d2a2928), SkBits2Float(0x43962be6), SkBits2Float(0x3a2a812a), SkBits2Float(0x2127ed29)); // 2.25206e-21f, 300.343f, 0.000650423f, 5.68957e-19f
path.conicTo(SkBits2Float(0x03210831), SkBits2Float(0x6a4b7bc0), SkBits2Float(0x6829ed27), SkBits2Float(0x55555b2d), SkBits2Float(0x1e2a3a2a)); // 4.73231e-37f, 6.14991e+25f, 3.20982e+24f, 1.46617e+13f, 9.01175e-21f
path.conicTo(SkBits2Float(0x27202140), SkBits2Float(0x3a3b2769), SkBits2Float(0xc4371f20), SkBits2Float(0xecc52a22), SkBits2Float(0x21512727)); // 2.22225e-15f, 0.000713936f, -732.486f, -1.90686e+27f, 7.08638e-19f
path.lineTo(SkBits2Float(0x68355b2d), SkBits2Float(0xf0685527)); // 3.42572e+24f, -2.87614e+29f
path.close();
path.moveTo(SkBits2Float(0x6829523a), SkBits2Float(0x2d555b2d)); // 3.19839e+24f, 1.21279e-11f
path.moveTo(SkBits2Float(0x68556829), SkBits2Float(0x5b2d5529)); // 4.03114e+24f, 4.87888e+16f
path.moveTo(SkBits2Float(0x1f2a322a), SkBits2Float(0xc0032108)); // 3.60404e-20f, -2.04889f
path.cubicTo(SkBits2Float(0x68572d55), SkBits2Float(0xf05bd24b), SkBits2Float(0x8c55272d), SkBits2Float(0x212a292a), SkBits2Float(0x0321082a), SkBits2Float(0xed4b7bc0)); // 4.06458e+24f, -2.72126e+29f, -1.64207e-31f, 5.76527e-19f, 4.7323e-37f, -3.93594e+27f
path.conicTo(SkBits2Float(0x212a8c6a), SkBits2Float(0x0329081f), SkBits2Float(0x6a4b7bc0), SkBits2Float(0x2829ed84), SkBits2Float(0x2d555b2d)); // 5.77841e-19f, 4.9674e-37f, 6.14991e+25f, 9.43289e-15f, 1.21279e-11f
path.moveTo(SkBits2Float(0x68385b2d), SkBits2Float(0xf0682955)); // 3.48239e+24f, -2.87402e+29f
path.conicTo(SkBits2Float(0x212a1f5b), SkBits2Float(0x8cef552a), SkBits2Float(0x295b2d2a), SkBits2Float(0x68210368), SkBits2Float(0x7bc05508)); // 5.76397e-19f, -3.6875e-31f, 4.86669e-14f, 3.04146e+24f, 1.99729e+36f
path.lineTo(SkBits2Float(0x68385b2d), SkBits2Float(0xf0682955)); // 3.48239e+24f, -2.87402e+29f
path.close();
path.moveTo(SkBits2Float(0x68385b2d), SkBits2Float(0xf0682955)); // 3.48239e+24f, -2.87402e+29f
path.lineTo(SkBits2Float(0x555b1b29), SkBits2Float(0x6c212a8c)); // 1.50569e+13f, 7.79352e+26f
path.conicTo(SkBits2Float(0x084b0321), SkBits2Float(0x6ac07b2a), SkBits2Float(0x395b2d7a), SkBits2Float(0x8c5bf055), SkBits2Float(0x1f212a3a)); // 6.10918e-34f, 1.16348e+26f, 0.000209024f, -1.69435e-31f, 3.4128e-20f
path.conicTo(SkBits2Float(0x290321d9), SkBits2Float(0x555b2d68), SkBits2Float(0x2a8c558c), SkBits2Float(0x2a212a1f), SkBits2Float(0x7bc00321)); // 2.91172e-14f, 1.50618e+13f, 2.49284e-13f, 1.43143e-13f, 1.99397e+36f
path.lineTo(SkBits2Float(0x68385b2d), SkBits2Float(0xf0682955)); // 3.48239e+24f, -2.87402e+29f
path.close();
path.moveTo(SkBits2Float(0x68385b2d), SkBits2Float(0xf0682955)); // 3.48239e+24f, -2.87402e+29f
path.lineTo(SkBits2Float(0x8c2aed7a), SkBits2Float(0x1f2128c0)); // -1.31678e-31f, 3.41268e-20f
path.lineTo(SkBits2Float(0x68385b2d), SkBits2Float(0xf0682955)); // 3.48239e+24f, -2.87402e+29f
path.close();
SkPath path2(path);
testPathOpFailSkipAssert(reporter, path1, path2, (SkPathOp) 0, filename);
}
static struct TestDesc failTests[] = {
TEST(fuzz763_23),
TEST(fuzz763_26),
TEST(fuzz763_25),
TEST(fuzz763_24),
TEST(fuzz763_23),
TEST(fuzz763_22),
TEST(fuzz763_21),
TEST(fuzz763_20),