From b956373b6f62bfc72b71070b50f1f053225cab8a Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 1 Feb 2007 18:39:49 +0000 Subject: [PATCH] Check for out-of-bounds access Originally committed as revision 7797 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/vc1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 5649484a9f..0c17083039 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -2890,8 +2890,8 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c ac_val -= 16 * s->block_wrap[n]; q1 = s->current_picture.qscale_table[mb_pos]; - if(dc_pred_dir && c_avail) q2 = s->current_picture.qscale_table[mb_pos - 1]; - if(!dc_pred_dir && a_avail) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride]; + if(dc_pred_dir && c_avail && mb_pos) q2 = s->current_picture.qscale_table[mb_pos - 1]; + if(!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride]; if(n && n<4) q2 = q1; if(coded) {