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
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 @@
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();
}