Browse code

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>

Michael Niedermayer authored on 2014/11/27 02:56:39
Showing 1 changed files
... ...
@@ -172,6 +172,9 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
172 172
         context->frame_size = avpicture_get_size(avctx->pix_fmt, avctx->width,
173 173
                                                  avctx->height);
174 174
     }
175
+    if (context->frame_size < 0)
176
+        return context->frame_size;
177
+
175 178
     need_copy = !avpkt->buf || context->is_2_4_bpp || context->is_yuv2 || context->is_lt_16bpp;
176 179
 
177 180
     frame->pict_type        = AV_PICTURE_TYPE_I;