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

Side by Side Diff: src/effects/SkMergeImageFilter.cpp

Issue 106943002: Fixed a few places where uninitialized memory could have been read (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Removed bad scalar checks in SkColorMatrixFilter.cpp 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkMergeImageFilter.h" 8 #include "SkMergeImageFilter.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkDevice.h" 10 #include "SkDevice.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 159
160 SkMergeImageFilter::SkMergeImageFilter(SkFlattenableReadBuffer& buffer) 160 SkMergeImageFilter::SkMergeImageFilter(SkFlattenableReadBuffer& buffer)
161 : INHERITED(-1, buffer) { 161 : INHERITED(-1, buffer) {
162 bool hasModes = buffer.readBool(); 162 bool hasModes = buffer.readBool();
163 if (hasModes) { 163 if (hasModes) {
164 this->initAllocModes(); 164 this->initAllocModes();
165 int nbInputs = countInputs(); 165 int nbInputs = countInputs();
166 size_t size = nbInputs * sizeof(fModes[0]); 166 size_t size = nbInputs * sizeof(fModes[0]);
167 SkASSERT(buffer.getArrayCount() == size); 167 SkASSERT(buffer.getArrayCount() == size);
168 buffer.readByteArray(fModes, size); 168 if (buffer.readByteArray(fModes, size)) {
169 for (int i = 0; i < nbInputs; ++i) { 169 for (int i = 0; i < nbInputs; ++i) {
170 buffer.validate(SkIsValidMode((SkXfermode::Mode)fModes[i])); 170 buffer.validate(SkIsValidMode((SkXfermode::Mode)fModes[i]));
171 }
171 } 172 }
172 } else { 173 } else {
173 fModes = 0; 174 fModes = 0;
174 } 175 }
175 } 176 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698