fuzz hang fix and pathops client debugging

The ASAN fuzzer on chrome caught a hanging state.

To capture the data, allow the pathops client debugging
to run in a release build.

TBR=reed@google.com
BUG=665295

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4834

Change-Id: I6b2c2baabd63994f63aa730d2ee7828986b5ab89
Reviewed-on: https://skia-review.googlesource.com/4834
Commit-Queue: Cary Clark <caryclark@google.com>
Reviewed-by: Cary Clark <caryclark@google.com>
This commit is contained in:
Cary Clark 2016-11-15 13:22:25 -05:00
parent fb191da789
commit 918fb1fe6f
7 changed files with 50 additions and 8 deletions

View File

@ -837,12 +837,19 @@ SkOpSpanBase* SkOpSegment::markAndChaseDone(SkOpSpanBase* start, SkOpSpanBase* e
markDone(minSpan);
SkOpSpanBase* last = nullptr;
SkOpSegment* other = this;
SkOpSpan* priorDone = nullptr;
SkOpSpan* lastDone = nullptr;
while ((other = other->nextChase(&start, &step, &minSpan, &last))) {
if (other->done()) {
SkASSERT(!last);
break;
}
if (lastDone == minSpan || priorDone == minSpan) {
return nullptr;
}
other->markDone(minSpan);
priorDone = lastDone;
lastDone = minSpan;
}
return last;
}

View File

@ -13,7 +13,7 @@
#include "SkPathOpsDebug.h"
#include "SkString.h"
#ifdef SK_DEBUG
#if DEBUG_DUMP_VERIFY
bool SkPathOpsDebug::gDumpOp; // set to true to write op to file before a crash
bool SkPathOpsDebug::gVerifyOp; // set to true to compare result against regions
#endif
@ -2906,7 +2906,7 @@ void SkPathOpsDebug::ShowOnePath(const SkPath& path, const char* name, bool incl
showPathContours(iter, name);
}
#ifdef SK_DEBUG
#if DEBUG_DUMP_VERIFY
#include "SkData.h"
#include "SkStream.h"

View File

@ -58,6 +58,7 @@ class SkOpContourHead;
#define DEBUG_CUBIC_BINARY_SEARCH 0
#define DEBUG_CUBIC_SPLIT 0
#define DEBUG_DUMP_SEGMENTS 0
#define DEBUG_DUMP_VERIFY 0
#define DEBUG_FLOW 0
#define DEBUG_LIMIT_WIND_SUM 0
#define DEBUG_MARK_DONE 0
@ -87,6 +88,7 @@ class SkOpContourHead;
#define DEBUG_COINCIDENCE_VERBOSE 01
#define DEBUG_CUBIC_BINARY_SEARCH 0
#define DEBUG_CUBIC_SPLIT 1
#define DEBUG_DUMP_VERIFY 0
#define DEBUG_DUMP_SEGMENTS 1
#define DEBUG_FLOW 1
#define DEBUG_LIMIT_WIND_SUM 15
@ -375,7 +377,7 @@ public:
static bool gRunFail;
static bool gVeryVerbose;
#ifdef SK_DEBUG
#if DEBUG_DUMP_VERIFY
static bool gDumpOp;
static bool gVerifyOp;

View File

@ -223,7 +223,10 @@ bool OpDebug(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result
SkOpGlobalState globalState(contourList, &allocator
SkDEBUGPARAMS(skipAssert) SkDEBUGPARAMS(testName));
SkOpCoincidence coincidence(&globalState);
#ifdef SK_DEBUG
#if DEBUG_DUMP_VERIFY
#ifndef SK_DEBUG
const char* testName = "release";
#endif
if (SkPathOpsDebug::gDumpOp) {
SkPathOpsDebug::DumpOp(one, two, op, testName);
}
@ -316,7 +319,7 @@ bool OpDebug(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result
}
bool Op(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result) {
#ifdef SK_DEBUG
#if DEBUG_DUMP_VERIFY
if (SkPathOpsDebug::gVerifyOp) {
if (!OpDebug(one, two, op, result SkDEBUGPARAMS(false) SkDEBUGPARAMS(nullptr))) {
SkPathOpsDebug::ReportOpFail(one, two, op);

View File

@ -158,7 +158,10 @@ bool SimplifyDebug(const SkPath& path, SkPath* result
SkOpGlobalState globalState(contourList, &allocator
SkDEBUGPARAMS(skipAssert) SkDEBUGPARAMS(testName));
SkOpCoincidence coincidence(&globalState);
#ifdef SK_DEBUG
#if DEBUG_DUMP_VERIFY
#ifndef SK_DEBUG
const char* testName = "release";
#endif
if (SkPathOpsDebug::gDumpOp) {
SkPathOpsDebug::DumpSimplify(path, testName);
}
@ -223,7 +226,7 @@ bool SimplifyDebug(const SkPath& path, SkPath* result
}
bool Simplify(const SkPath& path, SkPath* result) {
#ifdef SK_DEBUG
#if DEBUG_DUMP_VERIFY
if (SkPathOpsDebug::gVerifyOp) {
if (!SimplifyDebug(path, result SkDEBUGPARAMS(false) SkDEBUGPARAMS(nullptr))) {
SkPathOpsDebug::ReportSimplifyFail(path);

View File

@ -8348,7 +8348,34 @@ path.conicTo(SkBits2Float(0x552d5b5b), SkBits2Float(0x3b5a6839), SkBits2Float(0x
testPathOpFuzz(reporter, path1, path2, (SkPathOp) 0, filename);
}
static void fuzzhang_1(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType((SkPath::FillType) 1);
path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0
path.cubicTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000), SkBits2Float(0x668ece09), SkBits2Float(0x00000000), SkBits2Float(0x6751c81a), SkBits2Float(0x61c4b0fb)); // 0, 0, 3.37188e+23f, 0, 9.90666e+23f, 4.53539e+20f
path.conicTo(SkBits2Float(0x66f837a9), SkBits2Float(0x00000000), SkBits2Float(0x00000000), SkBits2Float(0x00000000), SkBits2Float(0x3f823406)); // 5.86087e+23f, 0, 0, 0, 1.01721f
path.close();
path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0
path.quadTo(SkBits2Float(0x675b1bfe), SkBits2Float(0x00000000), SkBits2Float(0x67d76c42), SkBits2Float(0x6292c469)); // 1.03471e+24f, 0, 2.03461e+24f, 1.35369e+21f
path.cubicTo(SkBits2Float(0x6a16df68), SkBits2Float(0x651a2f15), SkBits2Float(0x6c1e7f31), SkBits2Float(0x67a1f9b4), SkBits2Float(0x00000000), SkBits2Float(0x6a2a291f)); // 4.55985e+25f, 4.55071e+22f, 7.66444e+26f, 1.52981e+24f, 0, 5.14279e+25f
path.conicTo(SkBits2Float(0x680dcb75), SkBits2Float(0x68dd898d), SkBits2Float(0x681a434a), SkBits2Float(0x6871046b), SkBits2Float(0x3fea0440)); // 2.67843e+24f, 8.36944e+24f, 2.91394e+24f, 4.55269e+24f, 1.82825f
path.quadTo(SkBits2Float(0x679e1b26), SkBits2Float(0x687703c4), SkBits2Float(0x00000000), SkBits2Float(0x687d2968)); // 1.49327e+24f, 4.66598e+24f, 0, 4.78209e+24f
path.lineTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0
path.close();
SkPath path1(path);
path.reset();
path.setFillType((SkPath::FillType) 0);
path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0
path.cubicTo(SkBits2Float(0x535353ec), SkBits2Float(0x98989898), SkBits2Float(0x98989898), SkBits2Float(0xf207f36e), SkBits2Float(0xf3f2f2f2), SkBits2Float(0xed3a9781)); // 9.07646e+11f, -3.94452e-24f, -3.94452e-24f, -2.69278e+30f, -3.84968e+31f, -3.60921e+27f
path.quadTo(SkBits2Float(0xf8f8c0ed), SkBits2Float(0xf8f8f8f8), SkBits2Float(0x9f9f9f9f), SkBits2Float(0x3014149f)); // -4.03626e+34f, -4.03981e+34f, -6.76032e-20f, 5.38714e-10f
SkPath path2(path);
testPathOp(reporter, path1, path2, (SkPathOp) 0, filename);
}
static struct TestDesc failTests[] = {
TEST(fuzzhang_1),
TEST(fuzz763_57),
TEST(fuzz763_56),
TEST(fuzz763_55),

View File

@ -137,7 +137,7 @@ static bool should_run(const char* testName, bool isGPUTest) {
int test_main();
int test_main() {
#ifdef SK_DEBUG
#if DEBUG_DUMP_VERIFY
SkPathOpsDebug::gDumpOp = FLAGS_dumpOp;
SkPathOpsDebug::gVerifyOp = FLAGS_verifyOp;
#endif