aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/SkDashPathEffect.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-13 14:45:29 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-13 14:45:29 +0000
commit6b3eebce43dcd0e409ce953d2a2ea93df2b97733 (patch)
tree7ed9813cc3e5f3e6b304e45e7807f711d355171f /src/effects/SkDashPathEffect.cpp
parentc44672c8809209440903cbfc2931fcefa54d8905 (diff)
Add check for bad dash interval in dash effect picture read
BUG=skia:2542 R=caryclark@google.com, reed@google.com Author: egdaniel@google.com Review URL: https://codereview.chromium.org/275053004 git-svn-id: http://skia.googlecode.com/svn/trunk@14708 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects/SkDashPathEffect.cpp')
-rw-r--r--src/effects/SkDashPathEffect.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp
index 24361bd369..f6c7caecd9 100644
--- a/src/effects/SkDashPathEffect.cpp
+++ b/src/effects/SkDashPathEffect.cpp
@@ -565,10 +565,12 @@ SkDashPathEffect::SkDashPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {
if (useOldPic) {
fPhase = 0;
- for (int i = 0; i < fInitialDashIndex; ++i) {
- fPhase += fIntervals[i];
+ if (fInitialDashLength != -1) { // Signal for bad dash interval
+ for (int i = 0; i < fInitialDashIndex; ++i) {
+ fPhase += fIntervals[i];
+ }
+ fPhase += fIntervals[fInitialDashIndex] - fInitialDashLength;
}
- fPhase += fIntervals[fInitialDashIndex] - fInitialDashLength;
} else {
this->setInternalMembers(fPhase);
}