aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar senorblanco <senorblanco@chromium.org>2016-06-07 12:36:00 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-07 12:36:01 -0700
commit93e3fff79eaaa86bc2fb740a42111a074ccc73ab (patch)
tree65fb60436356a20b6e036a95d76db0847f9ca2a9 /src
parentd67238421d661ea5dfd110a8028973801a7d42a1 (diff)
Fix for rare crash in Poly::addEdge().
Don't add an edge if the bottom vertex was already added, or if an island vertex has a left poly but no right poly. (Sorry for the lack of test, but the only reduction I could create was still a huge path and only crashes in Chrome.) BUG=617907 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2043873005 Review-Url: https://codereview.chromium.org/2043873005
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrTessellator.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gpu/GrTessellator.cpp b/src/gpu/GrTessellator.cpp
index 25d1bb3a24..fc09c0c649 100644
--- a/src/gpu/GrTessellator.cpp
+++ b/src/gpu/GrTessellator.cpp
@@ -418,13 +418,12 @@ struct Poly {
if (!fTail) {
fHead = fTail = ALLOC_NEW(MonotonePoly, (e, side), alloc);
fCount += 2;
+ } else if (e->fBottom == fTail->fLastEdge->fBottom) {
+ return poly;
} else if (side == fTail->fSide) {
fTail->addEdge(e);
fCount++;
} else {
- if (e->fBottom == fTail->fLastEdge->fBottom) {
- return poly;
- }
e = ALLOC_NEW(Edge, (fTail->fLastEdge->fBottom, e->fBottom, 1), alloc);
fTail->addEdge(e);
fCount++;
@@ -1240,7 +1239,7 @@ Poly* tessellate(Vertex* vertices, SkChunkAlloc& alloc) {
}
if (v->fFirstEdgeBelow) {
if (!v->fFirstEdgeAbove) {
- if (leftPoly) {
+ if (leftPoly && rightPoly) {
if (leftPoly == rightPoly) {
if (leftPoly->fTail && leftPoly->fTail->fSide == Poly::kLeft_Side) {
leftPoly = new_poly(&polys, leftPoly->lastVertex(),