Index: src/effects/SkDashPathEffect.cpp |
diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp |
index 40990585024730af184931f0f53f014b855771bf..fc1c80bd2beca36787fbe6b2d6f4f34ec5491726 100644 |
--- a/src/effects/SkDashPathEffect.cpp |
+++ b/src/effects/SkDashPathEffect.cpp |
@@ -554,6 +554,11 @@ SkDashPathEffect::SkDashPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED( |
fScaleToFit = buffer.readBool(); |
fCount = buffer.getArrayCount(); |
- fIntervals = (SkScalar*)sk_malloc_throw(sizeof(SkScalar) * fCount); |
- buffer.readScalarArray(fIntervals, fCount); |
+ size_t allocSize = sizeof(SkScalar) * fCount; |
+ if (buffer.validateAvailable(allocSize)) { |
+ fIntervals = (SkScalar*)sk_malloc_throw(allocSize); |
+ buffer.readScalarArray(fIntervals, fCount); |
+ } else { |
+ fIntervals = NULL; |
+ } |
} |