blob: 0553ceefd4a3bc051f0fc2b52c773b0dba2690cb [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001From 0d3a3b9f8907625b361420d48fe05716859620ff Mon Sep 17 00:00:00 2001
2From: Michael Niedermayer <michaelni@gmx.at>
3Date: Wed, 26 Nov 2014 18:56:39 +0100
4Subject: [PATCH] avcodec/rawdec: Check the return code of
5 avpicture_get_size()
6
7(Upstream commit 1d3a3b9f8907625b361420d48fe05716859620ff)
8
9Fixes out of array access
10Fixes: asan_heap-oob_22388d0_3435_cov_3297128910_small_roll5_FlashCine1.cine
11Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
12
13Upstream-Status: Backport
14
15Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
16Signed-off-by: Yue Tao <yue.tao@windriver.com>
17---
18 libavcodec/rawdec.c | 3 +++
19 1 file changed, 3 insertions(+)
20
21diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
22index 28792a1..647dfa9 100644
23--- a/gst-libs/ext/libav/libavcodec/rawdec.c
24+++ b/gst-libs/ext/libav/libavcodec/rawdec.c
25@@ -87,6 +87,9 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
26
27 ff_set_systematic_pal2(context->palette, avctx->pix_fmt);
28 context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
29+ if (context->length < 0)
30+ return context->length;
31+
32 if((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) &&
33 avctx->pix_fmt==PIX_FMT_PAL8 &&
34 (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){
35--
361.7.9.5
37