Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | From 0d3a3b9f8907625b361420d48fe05716859620ff Mon Sep 17 00:00:00 2001 |
| 2 | From: Michael Niedermayer <michaelni@gmx.at> |
| 3 | Date: Wed, 26 Nov 2014 18:56:39 +0100 |
| 4 | Subject: [PATCH] avcodec/rawdec: Check the return code of |
| 5 | avpicture_get_size() |
| 6 | |
| 7 | (Upstream commit 1d3a3b9f8907625b361420d48fe05716859620ff) |
| 8 | |
| 9 | Fixes out of array access |
| 10 | Fixes: asan_heap-oob_22388d0_3435_cov_3297128910_small_roll5_FlashCine1.cine |
| 11 | Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind |
| 12 | |
| 13 | Upstream-Status: Backport |
| 14 | |
| 15 | Signed-off-by: Michael Niedermayer <michaelni@gmx.at> |
| 16 | Signed-off-by: Yue Tao <yue.tao@windriver.com> |
| 17 | --- |
| 18 | libavcodec/rawdec.c | 3 +++ |
| 19 | 1 file changed, 3 insertions(+) |
| 20 | |
| 21 | diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c |
| 22 | index 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 | -- |
| 36 | 1.7.9.5 |
| 37 | |