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

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

Issue 729583002: Added missing validation (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | 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 * 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 "SkMatrixConvolutionImageFilter.h" 8 #include "SkMatrixConvolutionImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 uint32_t uniqueID) { 60 uint32_t uniqueID) {
61 if (kernelSize.width() < 1 || kernelSize.height() < 1) { 61 if (kernelSize.width() < 1 || kernelSize.height() < 1) {
62 return NULL; 62 return NULL;
63 } 63 }
64 if (gMaxKernelSize / kernelSize.fWidth < kernelSize.fHeight) { 64 if (gMaxKernelSize / kernelSize.fWidth < kernelSize.fHeight) {
65 return NULL; 65 return NULL;
66 } 66 }
67 if (!kernel) { 67 if (!kernel) {
68 return NULL; 68 return NULL;
69 } 69 }
70 if ((kernelOffset.fX < 0) || (kernelOffset.fX >= kernelSize.fWidth) ||
71 (kernelOffset.fY < 0) || (kernelOffset.fY >= kernelSize.fHeight)) {
72 return NULL;
73 }
70 return SkNEW_ARGS(SkMatrixConvolutionImageFilter, (kernelSize, kernel, gain, bias, 74 return SkNEW_ARGS(SkMatrixConvolutionImageFilter, (kernelSize, kernel, gain, bias,
71 kernelOffset, tileMode, c onvolveAlpha, 75 kernelOffset, tileMode, c onvolveAlpha,
72 input, cropRect, uniqueID )); 76 input, cropRect, uniqueID ));
73 } 77 }
74 78
75 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING 79 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
76 static bool tile_mode_is_valid(SkMatrixConvolutionImageFilter::TileMode tileMode ) { 80 static bool tile_mode_is_valid(SkMatrixConvolutionImageFilter::TileMode tileMode ) {
77 switch (tileMode) { 81 switch (tileMode) {
78 case SkMatrixConvolutionImageFilter::kClamp_TileMode: 82 case SkMatrixConvolutionImageFilter::kClamp_TileMode:
79 case SkMatrixConvolutionImageFilter::kRepeat_TileMode: 83 case SkMatrixConvolutionImageFilter::kRepeat_TileMode:
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 fKernelSize, 406 fKernelSize,
403 fKernel, 407 fKernel,
404 fGain, 408 fGain,
405 fBias, 409 fBias,
406 fKernelOffset, 410 fKernelOffset,
407 convert_tilemodes(fTileMode), 411 convert_tilemodes(fTileMode),
408 fConvolveAlpha); 412 fConvolveAlpha);
409 return true; 413 return true;
410 } 414 }
411 #endif 415 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698