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

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

Issue 23548034: Follow up to serialization validation code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 months 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 if (fModes) { 152 if (fModes) {
153 buffer.writeByteArray(fModes, countInputs() * sizeof(fModes[0])); 153 buffer.writeByteArray(fModes, countInputs() * sizeof(fModes[0]));
154 } 154 }
155 } 155 }
156 156
157 SkMergeImageFilter::SkMergeImageFilter(SkFlattenableReadBuffer& buffer) : INHERI TED(buffer) { 157 SkMergeImageFilter::SkMergeImageFilter(SkFlattenableReadBuffer& buffer) : INHERI TED(buffer) {
158 bool hasModes = buffer.readBool(); 158 bool hasModes = buffer.readBool();
159 if (hasModes) { 159 if (hasModes) {
160 this->initAllocModes(); 160 this->initAllocModes();
161 int nbInputs = countInputs(); 161 int nbInputs = countInputs();
162 SkASSERT(buffer.getArrayCount() == nbInputs * sizeof(fModes[0])); 162 bool sizeMatches = buffer.getArrayCount() == nbInputs * sizeof(fModes[0] );
163 buffer.validate(sizeMatches);
164 SkASSERT(sizeMatches);
163 buffer.readByteArray(fModes); 165 buffer.readByteArray(fModes);
164 for (int i = 0; i < nbInputs; ++i) { 166 for (int i = 0; i < nbInputs; ++i) {
165 buffer.validate(SkIsValidMode((SkXfermode::Mode)fModes[i])); 167 buffer.validate(SkIsValidMode((SkXfermode::Mode)fModes[i]));
166 } 168 }
167 } else { 169 } else {
168 fModes = 0; 170 fModes = 0;
169 } 171 }
170 } 172 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698