Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | From 8b0e96e1f21b761ca15dbb470cd619a1ebf86c3e Mon Sep 17 00:00:00 2001 |
| 2 | From: Michael Niedermayer <michaelni@gmx.at> |
| 3 | Date: Fri, 3 Oct 2014 14:45:04 +0200 |
| 4 | Subject: [PATCH] avcodec/mmvideo: Bounds check 2nd line of HHV Intra blocks |
| 5 | |
| 6 | (Upstream commit 8b0e96e1f21b761ca15dbb470cd619a1ebf86c3e) |
| 7 | |
| 8 | Fixes out of array access |
| 9 | Fixes: asan_heap-oob_4da4f3_8_asan_heap-oob_4da4f3_419_scene1a.mm |
| 10 | |
| 11 | Upstream-Status: Backport |
| 12 | |
| 13 | Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind |
| 14 | Signed-off-by: Michael Niedermayer <michaelni@gmx.at> |
| 15 | Signed-off-by: Yue Tao <yue.tao@windriver.com> |
| 16 | --- |
| 17 | libavcodec/mmvideo.c | 2 +- |
| 18 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 19 | |
| 20 | diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c |
| 21 | index 026d463..9ff6393 100644 |
| 22 | --- a/gst-libs/ext/libav/libavcodec/mmvideo.c |
| 23 | +++ b/gst-libs/ext/libav/libavcodec/mmvideo.c |
| 24 | @@ -104,7 +104,7 @@ static void mm_decode_intra(MmContext * s, int half_horiz, int half_vert, const |
| 25 | |
| 26 | if (color) { |
| 27 | memset(s->frame.data[0] + y*s->frame.linesize[0] + x, color, run_length); |
| 28 | - if (half_vert) |
| 29 | + if (half_vert && y + half_vert < s->avctx->height) |
| 30 | memset(s->frame.data[0] + (y+1)*s->frame.linesize[0] + x, color, run_length); |
| 31 | } |
| 32 | x+= run_length; |
| 33 | -- |
| 34 | 1.7.9.5 |
| 35 | |