changeset 4303:7e907f7d6a21 libavcodec

Check mb_pos is big enough before trying to access data left or above. Fixes out-of-bound access for http://samples.mplayerhq.hu/V-codecs/WMV9/nokia_n90.wmv
author reimar
date Sun, 17 Dec 2006 11:11:44 +0000
parents a0f83004d485
children dbaae8e5ec55
files vc1.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/vc1.c	Thu Dec 14 17:58:25 2006 +0000
+++ b/vc1.c	Sun Dec 17 11:11:44 2006 +0000
@@ -3072,8 +3072,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) {