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

Side by Side 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 unified diff | Download patch
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkDashPathEffect.h" 10 #include "SkDashPathEffect.h"
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 return SkNEW_ARGS(SkDashPathEffect, (buffer)); 547 return SkNEW_ARGS(SkDashPathEffect, (buffer));
548 } 548 }
549 549
550 SkDashPathEffect::SkDashPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED( buffer) { 550 SkDashPathEffect::SkDashPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED( buffer) {
551 fInitialDashIndex = buffer.readInt(); 551 fInitialDashIndex = buffer.readInt();
552 fInitialDashLength = buffer.readScalar(); 552 fInitialDashLength = buffer.readScalar();
553 fIntervalLength = buffer.readScalar(); 553 fIntervalLength = buffer.readScalar();
554 fScaleToFit = buffer.readBool(); 554 fScaleToFit = buffer.readBool();
555 555
556 fCount = buffer.getArrayCount(); 556 fCount = buffer.getArrayCount();
557 fIntervals = (SkScalar*)sk_malloc_throw(sizeof(SkScalar) * fCount); 557 size_t allocSize = sizeof(SkScalar) * fCount;
558 buffer.readScalarArray(fIntervals, fCount); 558 if (buffer.validateAvailable(allocSize)) {
559 fIntervals = (SkScalar*)sk_malloc_throw(allocSize);
560 buffer.readScalarArray(fIntervals, fCount);
561 } else {
562 fIntervals = NULL;
563 }
559 } 564 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698