Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Unified Diff: src/gpu/GrPathUtils.cpp

Issue 951403002: Fix assert in GPU path rendering found by fuzzer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Return MAX_POINTS_PER_CURVE when the distance is infinite Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPathUtils.cpp
diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp
index 8e7a01d0915aa74a039c8d8e05abf3540fd4e4c3..1281f4a5ec32baa09ef5f1e7c6e65417489a75e7 100644
--- a/src/gpu/GrPathUtils.cpp
+++ b/src/gpu/GrPathUtils.cpp
@@ -46,6 +46,8 @@ uint32_t GrPathUtils::quadraticPointCount(const SkPoint points[],
SkScalar d = points[1].distanceToLineSegmentBetween(points[0], points[2]);
if (d <= tol) {
return 1;
+ } else if (!SkScalarIsFinite(d)) {
+ return MAX_POINTS_PER_CURVE;
} else {
// Each time we subdivide, d should be cut in 4. So we need to
// subdivide x = log4(d/tol) times. x subdivisions creates 2^(x)
@@ -101,6 +103,8 @@ uint32_t GrPathUtils::cubicPointCount(const SkPoint points[],
d = SkScalarSqrt(d);
if (d <= tol) {
return 1;
+ } else if (!SkScalarIsFinite(d)) {
+ return MAX_POINTS_PER_CURVE;
} else {
int temp = SkScalarCeilToInt(SkScalarSqrt(SkScalarDiv(d, tol)));
int pow2 = GrNextPow2(temp);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698