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

Side by Side Diff: src/gpu/effects/GrConvolutionEffect.cpp

Issue 23340003: Fix stack buffer read overflow in GrConvolutionEffect::TestCreate. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Avoid signed / unsigned comparison. Created 7 years, 4 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
« 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 Google Inc. 2 * Copyright 2012 Google Inc.
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 "GrConvolutionEffect.h" 8 #include "GrConvolutionEffect.h"
9 #include "gl/GrGLEffect.h" 9 #include "gl/GrGLEffect.h"
10 #include "gl/GrGLEffectMatrix.h" 10 #include "gl/GrGLEffectMatrix.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 GR_DEFINE_EFFECT_TEST(GrConvolutionEffect); 220 GR_DEFINE_EFFECT_TEST(GrConvolutionEffect);
221 221
222 GrEffectRef* GrConvolutionEffect::TestCreate(SkMWCRandom* random, 222 GrEffectRef* GrConvolutionEffect::TestCreate(SkMWCRandom* random,
223 GrContext*, 223 GrContext*,
224 const GrDrawTargetCaps&, 224 const GrDrawTargetCaps&,
225 GrTexture* textures[]) { 225 GrTexture* textures[]) {
226 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : 226 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
227 GrEffectUnitTest::kAlphaTextureIdx; 227 GrEffectUnitTest::kAlphaTextureIdx;
228 Direction dir = random->nextBool() ? kX_Direction : kY_Direction; 228 Direction dir = random->nextBool() ? kX_Direction : kY_Direction;
229 int radius = random->nextRangeU(1, kMaxKernelRadius); 229 int radius = random->nextRangeU(1, kMaxKernelRadius);
230 float kernel[kMaxKernelRadius]; 230 float kernel[kMaxKernelWidth];
231 for (int i = 0; i < kMaxKernelRadius; ++i) { 231 for (size_t i = 0; i < SK_ARRAY_COUNT(kernel); ++i) {
232 kernel[i] = random->nextSScalar1(); 232 kernel[i] = random->nextSScalar1();
233 } 233 }
234 float bounds[2]; 234 float bounds[2];
235 for (int i = 0; i < 2; ++i) { 235 for (int i = 0; i < 2; ++i) {
236 bounds[i] = random->nextF(); 236 bounds[i] = random->nextF();
237 } 237 }
238 238
239 bool useBounds = random->nextBool(); 239 bool useBounds = random->nextBool();
240 return GrConvolutionEffect::Create(textures[texIdx], 240 return GrConvolutionEffect::Create(textures[texIdx],
241 dir, 241 dir,
242 radius, 242 radius,
243 kernel, 243 kernel,
244 useBounds, 244 useBounds,
245 bounds); 245 bounds);
246 } 246 }
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