changeset 4456:33f181383a21 libavcodec

Check for out-of-bounds access
author kostya
date Thu, 01 Feb 2007 18:39:49 +0000
parents 8ecfb7ecbb53
children 99e960878498
files vc1.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/vc1.c	Thu Feb 01 09:48:09 2007 +0000
+++ b/vc1.c	Thu Feb 01 18:39:49 2007 +0000
@@ -2890,8 +2890,8 @@
         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) {