From 4348663da8271f4b72594a0f5aa84036e6ee327b Mon Sep 17 00:00:00 2001 From: "bungeman@google.com" Date: Tue, 20 Aug 2013 15:20:34 +0000 Subject: [PATCH] Fix stack buffer read overflow in GrConvolutionEffect::TestCreate. BUG=skia:1532 R=bsalomon@google.com, robertphillips@google.com Review URL: https://codereview.chromium.org/23340003 git-svn-id: http://skia.googlecode.com/svn/trunk@10816 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/gpu/effects/GrConvolutionEffect.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp index aad7d49..925a818 100644 --- a/src/gpu/effects/GrConvolutionEffect.cpp +++ b/src/gpu/effects/GrConvolutionEffect.cpp @@ -227,12 +227,12 @@ GrEffectRef* GrConvolutionEffect::TestCreate(SkMWCRandom* random, GrEffectUnitTest::kAlphaTextureIdx; Direction dir = random->nextBool() ? kX_Direction : kY_Direction; int radius = random->nextRangeU(1, kMaxKernelRadius); - float kernel[kMaxKernelRadius]; - for (int i = 0; i < kMaxKernelRadius; ++i) { + float kernel[kMaxKernelWidth]; + for (size_t i = 0; i < SK_ARRAY_COUNT(kernel); ++i) { kernel[i] = random->nextSScalar1(); } float bounds[2]; - for (int i = 0; i < 2; ++i) { + for (size_t i = 0; i < SK_ARRAY_COUNT(bounds); ++i) { bounds[i] = random->nextF(); } -- 2.7.4