Browse code

avcodec/mmvideo: Bounds check 2nd line of HHV Intra blocks

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>
(cherry picked from commit 8b0e96e1f21b761ca15dbb470cd619a1ebf86c3e)

Conflicts:

libavcodec/mmvideo.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2014/10/03 21:45:04
Showing 1 changed files
... ...
@@ -104,7 +104,7 @@ static void mm_decode_intra(MmContext * s, int half_horiz, int half_vert, const
104 104
 
105 105
         if (color) {
106 106
             memset(s->frame.data[0] + y*s->frame.linesize[0] + x, color, run_length);
107
-            if (half_vert)
107
+            if (half_vert && y + half_vert < s->avctx->height)
108 108
                 memset(s->frame.data[0] + (y+1)*s->frame.linesize[0] + x, color, run_length);
109 109
         }
110 110
         x+= run_length;