diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-11-26 18:56:39 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-11-30 21:40:36 +0100 |
commit | 12e064d6c2ae66bd501872ab4fc2033588419f85 (patch) | |
tree | dd9aaa5500b2231eacd7dbd0dc164d8f56090b56 | |
parent | f2595a6c38eeed80cd228c5db142873c95f6b4d3 (diff) | |
download | ffmpeg-12e064d6c2ae66bd501872ab4fc2033588419f85.tar.gz |
avcodec/rawdec: Check the return code of avpicture_get_size()
Fixes out of array access
Fixes: asan_heap-oob_22388d0_3435_cov_3297128910_small_roll5_FlashCine1.cine
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1d3a3b9f8907625b361420d48fe05716859620ff)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/rawdec.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 28792a1688..647dfa9a0a 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -172,6 +172,9 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, context->frame_size = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); } + if (context->frame_size < 0) + return context->frame_size; + need_copy = !avpkt->buf || context->is_2_4_bpp || context->is_yuv2 || context->is_lt_16bpp; frame->pict_type = AV_PICTURE_TYPE_I; |