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

Unified Diff: src/utils/SkDashPath.cpp

Issue 2165013002: limit the number of points in SkDashPathEffect::asPoints (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: fix SpecialLineRec point count overflow Created 4 years, 5 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 | « src/effects/SkDashPathEffect.cpp ('k') | src/utils/SkDashPathPriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « src/effects/SkDashPathEffect.cpp ('k') | src/utils/SkDashPathPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698