diff options
-rw-r--r-- | src/gpu/GrTessellator.cpp | 4 | ||||
-rw-r--r-- | tests/TessellatingPathRendererTests.cpp | 15 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/gpu/GrTessellator.cpp b/src/gpu/GrTessellator.cpp index 1125ef44b2..fd7bf5133a 100644 --- a/src/gpu/GrTessellator.cpp +++ b/src/gpu/GrTessellator.cpp @@ -1013,6 +1013,7 @@ void merge_edges_above(Edge* edge, Edge* other, EdgeList* activeEdges, Vertex** rewind(activeEdges, current, edge->fTop, c); other->fWinding += edge->fWinding; disconnect(edge); + edge->fTop = edge->fBottom = nullptr; } else if (c.sweep_lt(edge->fTop->fPoint, other->fTop->fPoint)) { rewind(activeEdges, current, edge->fTop, c); other->fWinding += edge->fWinding; @@ -1033,6 +1034,7 @@ void merge_edges_below(Edge* edge, Edge* other, EdgeList* activeEdges, Vertex** rewind(activeEdges, current, edge->fTop, c); other->fWinding += edge->fWinding; disconnect(edge); + edge->fTop = edge->fBottom = nullptr; } else if (c.sweep_lt(edge->fBottom->fPoint, other->fBottom->fPoint)) { rewind(activeEdges, current, other->fTop, c); edge->fWinding += other->fWinding; @@ -1070,7 +1072,7 @@ void merge_collinear_edges(Edge* edge, EdgeList* activeEdges, Vertex** current, void split_edge(Edge* edge, Vertex* v, EdgeList* activeEdges, Vertex** current, Comparator& c, SkArenaAlloc& alloc) { - if (v == edge->fTop || v == edge->fBottom) { + if (!edge->fTop || !edge->fBottom || v == edge->fTop || v == edge->fBottom) { return; } LOG("splitting edge (%g -> %g) at vertex %g (%g, %g)\n", diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp index 0ff0af71e0..27dc7e5e4c 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -472,6 +472,20 @@ static SkPath create_path_31() { return path; } +// Reduction from skbug.com/7911 that causes a crash due to splitting a +// zombie edge. +static SkPath create_path_32() { + SkPath path; + path.moveTo( 0, 1.0927740941146660348e+24); + path.lineTo(2.9333931225865729333e+32, 16476101); + path.lineTo(1.0927731573659435417e+24, 1.0927740941146660348e+24); + path.lineTo(1.0927740941146660348e+24, 3.7616281094287041715e-37); + path.lineTo(1.0927740941146660348e+24, 1.0927740941146660348e+24); + path.lineTo(1.3061803026169399536e-33, 1.0927740941146660348e+24); + path.lineTo(4.7195362919941370727e-16, -8.4247545146051822591e+32); + return path; +} + static std::unique_ptr<GrFragmentProcessor> create_linear_gradient_processor(GrContext* ctx) { SkPoint pts[2] = { {0, 0}, {1, 1} }; @@ -563,5 +577,6 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { test_path(ctx, rtc.get(), create_path_29()); test_path(ctx, rtc.get(), create_path_30()); test_path(ctx, rtc.get(), create_path_31(), SkMatrix(), GrAAType::kCoverage); + test_path(ctx, rtc.get(), create_path_32()); } #endif |