Fill image including the padding areas To avoid uninitialized value access. Change-Id: I842d822bc2e9f4e5dea31fb8ea8415c269c48f22
diff --git a/test/encode_api_test.cc b/test/encode_api_test.cc index 19bedc6..a57dadc 100644 --- a/test/encode_api_test.cc +++ b/test/encode_api_test.cc
@@ -51,8 +51,8 @@ static void FillImage(aom_image_t *img, uint8_t val) { for (int p = 0; p < 3; ++p) { uint8_t *buf = img->planes[p]; - const int w = aom_img_plane_width(img, p); - const int h = aom_img_plane_height(img, p); + const int h = p == 0 ? (int)img->h : (int)((img->h + 1) / 2); + const int w = p == 0 ? (int)img->w : (int)((img->w + 1) / 2); for (int r = 0; r < h; ++r) { memset(buf, val, w); buf += img->stride[p]; @@ -65,8 +65,8 @@ rnd.Reset(::libaom_test::ACMRandom::DeterministicSeed()); for (int p = 0; p < 3; ++p) { uint8_t *buf = img->planes[p]; - const int h = p == 0 ? (int)img->d_h : (int)((img->d_h + 1) / 2); - const int w = p == 0 ? (int)img->d_w : (int)((img->d_w + 1) / 2); + const int h = p == 0 ? (int)img->h : (int)((img->h + 1) / 2); + const int w = p == 0 ? (int)img->w : (int)((img->w + 1) / 2); for (int r = 0; r < h; ++r) { for (int c = 0; c < w; ++c) { buf[c] = rnd.Rand8();