avcodec/utils: set AVFrame format unconditional
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 16 Feb 2014 00:28:26 +0000 (01:28 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 16 Feb 2014 00:34:35 +0000 (01:34 +0100)
Fixes inconsistency and out of array accesses
Fixes: 10cdd7e63e7f66e3e66273939e0863dd-asan_heap-oob_1a4ff32_7078_cov_4056274555_mov_h264_aac__mp4box_frag.mp4
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/utils.c

index ea77654..5d318dc 100644 (file)
@@ -766,8 +766,7 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame)
 
     switch (avctx->codec->type) {
     case AVMEDIA_TYPE_VIDEO:
-        if (frame->format < 0)
-            frame->format              = avctx->pix_fmt;
+        frame->format              = avctx->pix_fmt;
         if (!frame->sample_aspect_ratio.num)
             frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
         if (av_frame_get_colorspace(frame) == AVCOL_SPC_UNSPECIFIED)