Index: src/utils/SkDashPath.cpp |
diff --git a/src/utils/SkDashPath.cpp b/src/utils/SkDashPath.cpp |
index 8317d20f3725fb2d0d7937f4923d5b992707c20b..e06c2d2da355bbb80ee30a98448b697b08a18647 100644 |
--- a/src/utils/SkDashPath.cpp |
+++ b/src/utils/SkDashPath.cpp |
@@ -176,6 +176,7 @@ public: |
SkScalar ptCount = SkScalarMulDiv(pathLength, |
SkIntToScalar(intervalCount), |
intervalLength); |
+ ptCount = SkTMin(ptCount, SkDashPath::kMaxDashCount); |
caryclark
2016/07/21 12:22:59
Don't need the SkDashPath:: prefix here
|
int n = SkScalarCeilToInt(ptCount) << 2; |
dst->incReserve(n); |
@@ -255,7 +256,6 @@ bool SkDashPath::InternalFilter(SkPath* dst, const SkPath& src, SkStrokeRec* rec |
// 90 million dash segments and crashing the memory allocator. A limit of 1 million |
// segments seems reasonable: at 2 verbs per segment * 9 bytes per verb, this caps the |
// maximum dash memory overhead at roughly 17MB per path. |
- static const SkScalar kMaxDashCount = 1000000; |
dashCount += length * (count >> 1) / intervalLength; |
if (dashCount > kMaxDashCount) { |
dst->reset(); |