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

Side by Side Diff: src/effects/SkColorMatrixFilter.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
« no previous file with comments | « src/effects/SkColorFilters.cpp ('k') | src/effects/SkMergeImageFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 #include "SkColorMatrixFilter.h" 8 #include "SkColorMatrixFilter.h"
9 #include "SkColorMatrix.h" 9 #include "SkColorMatrix.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 301
302 void SkColorMatrixFilter::flatten(SkFlattenableWriteBuffer& buffer) const { 302 void SkColorMatrixFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
303 this->INHERITED::flatten(buffer); 303 this->INHERITED::flatten(buffer);
304 SkASSERT(sizeof(fMatrix.fMat)/sizeof(SkScalar) == 20); 304 SkASSERT(sizeof(fMatrix.fMat)/sizeof(SkScalar) == 20);
305 buffer.writeScalarArray(fMatrix.fMat, 20); 305 buffer.writeScalarArray(fMatrix.fMat, 20);
306 } 306 }
307 307
308 SkColorMatrixFilter::SkColorMatrixFilter(SkFlattenableReadBuffer& buffer) 308 SkColorMatrixFilter::SkColorMatrixFilter(SkFlattenableReadBuffer& buffer)
309 : INHERITED(buffer) { 309 : INHERITED(buffer) {
310 SkASSERT(buffer.getArrayCount() == 20); 310 SkASSERT(buffer.getArrayCount() == 20);
311 buffer.readScalarArray(fMatrix.fMat, 20); 311 if (buffer.readScalarArray(fMatrix.fMat, 20)) {
312 this->initState(fMatrix.fMat); 312 this->initState(fMatrix.fMat);
313 for (int i = 0; i < 20; ++i) {
314 buffer.validate(SkScalarIsFinite(fMatrix.fMat[i]));
sugoi1 2013/12/06 18:39:04 I didn't find anything obviously wrong with removi
315 } 313 }
316 } 314 }
317 315
318 bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) const { 316 bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) const {
319 if (matrix) { 317 if (matrix) {
320 memcpy(matrix, fMatrix.fMat, 20 * sizeof(SkScalar)); 318 memcpy(matrix, fMatrix.fMat, 20 * sizeof(SkScalar));
321 } 319 }
322 return true; 320 return true;
323 } 321 }
324 322
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 str->append("matrix: ("); 487 str->append("matrix: (");
490 for (int i = 0; i < 20; ++i) { 488 for (int i = 0; i < 20; ++i) {
491 str->appendScalar(fMatrix.fMat[i]); 489 str->appendScalar(fMatrix.fMat[i]);
492 if (i < 19) { 490 if (i < 19) {
493 str->append(", "); 491 str->append(", ");
494 } 492 }
495 } 493 }
496 str->append(")"); 494 str->append(")");
497 } 495 }
498 #endif 496 #endif
OLDNEW
« no previous file with comments | « src/effects/SkColorFilters.cpp ('k') | src/effects/SkMergeImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698