From 105654e376a736d243aef4a1d121abebce912e6b Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michaelni@gmx.at>
Date: Fri, 3 Oct 2014 04:30:58 +0200
Subject: [PATCH] avcodec/utils: Add case for jv to
 avcodec_align_dimensions2()

(Upstream commit 105654e376a736d243aef4a1d121abebce912e6b)

Fixes out of array accesses
Fixes: asan_heap-oob_12304aa_8_asan_heap-oob_4da4f3_300_intro.jv

Upstream-Status: Backport

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Yue Tao <yue.tao@windriver.com>
---
 libavcodec/utils.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d4f5532..c2c5579 100644
--- a/gst-libs/ext/libav/libavcodec/utils.c
+++ b/gst-libs/ext/libav/libavcodec/utils.c
@@ -173,6 +173,10 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int l
             w_align=4;
             h_align=4;
         }
+        if (s->codec_id == CODEC_ID_JV){
+            w_align = 8;
+            h_align = 8;
+        }
         break;
     case PIX_FMT_BGR24:
         if((s->codec_id == CODEC_ID_MSZH) || (s->codec_id == CODEC_ID_ZLIB)){
-- 
1.7.9.5

