summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_encodeframe.c
diff options
context:
space:
mode:
authorYaowu Xu <yaowu@google.com>2013-09-24 08:36:59 -0700
committerYaowu Xu <yaowu@google.com>2013-09-24 08:36:59 -0700
commit92a29c157fb7a82cc32550fec82e90b33d3250ed (patch)
treecee83a18cc447ecad100a6058e1449a31a295263 /vp9/encoder/vp9_encodeframe.c
parentdb9235657741ce3fa5b9226f55d780304320ef8c (diff)
downloadlibvpx-92a29c157fb7a82cc32550fec82e90b33d3250ed.tar
libvpx-92a29c157fb7a82cc32550fec82e90b33d3250ed.tar.gz
libvpx-92a29c157fb7a82cc32550fec82e90b33d3250ed.tar.bz2
libvpx-92a29c157fb7a82cc32550fec82e90b33d3250ed.zip
Change to prevent invalid memory access
After change of MI context storage , mi_8x8[] pointer may be null for a block outside of image border. The commit changes to access the data only after validation of mi_row and mi_col. Change-Id: I039c4eb486a228ea9d8e5f35ab9ae6717d718bf3
Diffstat (limited to 'vp9/encoder/vp9_encodeframe.c')
-rw-r--r--vp9/encoder/vp9_encodeframe.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index ee938bda9..0db506268 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -2348,18 +2348,19 @@ static void reset_skip_txfm_size_b(VP9_COMP *cpi, MODE_INFO **mi_8x8,
int mis, TX_SIZE max_tx_size, int bw, int bh,
int mi_row, int mi_col, BLOCK_SIZE bsize) {
VP9_COMMON * const cm = &cpi->common;
- MB_MODE_INFO * const mbmi = &mi_8x8[0]->mbmi;
- if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
+ if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) {
return;
-
- if (mbmi->tx_size > max_tx_size) {
- const int ymbs = MIN(bh, cm->mi_rows - mi_row);
- const int xmbs = MIN(bw, cm->mi_cols - mi_col);
-
- assert(vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP) ||
- get_skip_flag(mi_8x8, mis, ymbs, xmbs));
- set_txfm_flag(mi_8x8, mis, ymbs, xmbs, max_tx_size);
+ } else {
+ MB_MODE_INFO * const mbmi = &mi_8x8[0]->mbmi;
+ if (mbmi->tx_size > max_tx_size) {
+ const int ymbs = MIN(bh, cm->mi_rows - mi_row);
+ const int xmbs = MIN(bw, cm->mi_cols - mi_col);
+
+ assert(vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP) ||
+ get_skip_flag(mi_8x8, mis, ymbs, xmbs));
+ set_txfm_flag(mi_8x8, mis, ymbs, xmbs, max_tx_size);
+ }
}
}