From b957439c872638de9484edcac85e604d8c2d3a3c Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Fri, 11 Jul 2014 13:37:28 -0700 Subject: [PATCH] Fix a potential invalid memory access in non-RD coding flow This commit fixes a potential out-of-boundary memory access due to the use of reuse_inter_pred_sby in the non-RD coding flow. It resolves the corresponding asan error. Change-Id: Iff605f5921230966990013541cd855d698810922 --- test/cpu_speed_test.cc | 2 +- vp9/encoder/vp9_pickmode.c | 2 +- vp9/encoder/vp9_speed_features.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/cpu_speed_test.cc b/test/cpu_speed_test.cc index 9dca6014d..4477bf02d 100644 --- a/test/cpu_speed_test.cc +++ b/test/cpu_speed_test.cc @@ -139,5 +139,5 @@ VP9_INSTANTIATE_TEST_CASE( CpuSpeedTest, ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood, ::libvpx_test::kRealTime), - ::testing::Range(0, 8)); + ::testing::Range(0, 9)); } // namespace diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index 31e6fcb8d..e9fa3ded4 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -685,7 +685,7 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, int rate2 = 0; int64_t dist2 = 0; - const int dst_stride = pd->dst.stride; + const int dst_stride = cpi->sf.reuse_inter_pred_sby ? bw : pd->dst.stride; const int src_stride = p->src.stride; int block_idx = 0; diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c index f27118262..450cab4f2 100644 --- a/vp9/encoder/vp9_speed_features.c +++ b/vp9/encoder/vp9_speed_features.c @@ -296,6 +296,7 @@ static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf, } if (speed >= 8) { int i; + sf->max_intra_bsize = BLOCK_32X32; for (i = 0; i < BLOCK_SIZES; ++i) sf->inter_mode_mask[i] = INTER_NEAREST; }