Commit 38cdce8e authored by Yaowu Xu's avatar Yaowu Xu

Prevent access of array using -1 index

BUG=aomedia:685

Change-Id: I0698b281fbaff2e77a50f5dc9a10d752de6c6f79
parent 415d82ca
...@@ -2139,7 +2139,7 @@ static PARTITION_TYPE read_partition(AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -2139,7 +2139,7 @@ static PARTITION_TYPE read_partition(AV1_COMMON *cm, MACROBLOCKD *xd,
partition_plane_context(xd, mi_row, mi_col, has_rows, has_cols, bsize); partition_plane_context(xd, mi_row, mi_col, has_rows, has_cols, bsize);
const aom_prob *const probs = const aom_prob *const probs =
ctx < PARTITION_CONTEXTS ? cm->fc->partition_prob[ctx] : NULL; ctx < PARTITION_CONTEXTS ? cm->fc->partition_prob[ctx] : NULL;
FRAME_COUNTS *const counts = ctx < PARTITION_CONTEXTS ? xd->counts : NULL; FRAME_COUNTS *const counts = ctx >= 0 ? xd->counts : NULL;
#else #else
const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize); const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize);
const aom_prob *const probs = cm->fc->partition_prob[ctx]; const aom_prob *const probs = cm->fc->partition_prob[ctx];
......
...@@ -3304,7 +3304,7 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td, ...@@ -3304,7 +3304,7 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
#endif #endif
bsize); bsize);
#endif // CONFIG_CB4X4 #endif // CONFIG_CB4X4
const int *partition_cost = x->partition_cost[pl]; const int *partition_cost = pl >= 0 ? x->partition_cost[pl] : NULL;
#if CONFIG_SUPERTX #if CONFIG_SUPERTX
int this_rate_nocoef, sum_rate_nocoef = 0, best_rate_nocoef = INT_MAX; int this_rate_nocoef, sum_rate_nocoef = 0, best_rate_nocoef = INT_MAX;
int abort_flag; int abort_flag;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment