avcodec/mmvideo: Bounds check 2nd line of HHV Intra blocks
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 3 Oct 2014 12:45:04 +0000 (14:45 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 3 Oct 2014 12:46:43 +0000 (14:46 +0200)
Fixes out of array access
Fixes: asan_heap-oob_4da4f3_8_asan_heap-oob_4da4f3_419_scene1a.mm

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mmvideo.c

index 026d463..9ff6393 100644 (file)
@@ -109,7 +109,7 @@ static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert)
 
         if (color) {
             memset(s->frame->data[0] + y*s->frame->linesize[0] + x, color, run_length);
-            if (half_vert)
+            if (half_vert && y + half_vert < s->avctx->height)
                 memset(s->frame->data[0] + (y+1)*s->frame->linesize[0] + x, color, run_length);
         }
         x+= run_length;