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
diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp
index 24361bd..f6c7cae 100644
--- a/src/effects/SkDashPathEffect.cpp
+++ b/src/effects/SkDashPathEffect.cpp
@@ -565,10 +565,12 @@
 
     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);
     }