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

Unified Diff: src/effects/SkDashPathEffect.cpp

Issue 116773002: Fixed more fuzzer issues (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Changed isAvailable for validateAvailable Created 7 years 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
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;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698