Defense of system crash due to damaged random file. (ffmpeg 2.8.1 patch) 06/82206/1 accepted/tizen/common/20160805.130136 accepted/tizen/ivi/20160808.081142 accepted/tizen/mobile/20160808.080755 accepted/tizen/tv/20160808.080949 accepted/tizen/wearable/20160808.081055 submit/tizen/20160805.054353
authorMinje Ahn <minje.ahn@samsung.com>
Mon, 1 Aug 2016 23:57:51 +0000 (08:57 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Mon, 1 Aug 2016 23:57:51 +0000 (08:57 +0900)
Change-Id: Id0eced23749b7f4dd37b92f095f021f43561e282
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
libavcodec/utils.c

index c5fa50d..a87b680 100644 (file)
@@ -1578,6 +1578,13 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
     AVCodecInternal *avci = avctx->internal;
     int ret;
 
+    if (!avctx->codec)
+        return AVERROR(EINVAL);
+    if (avctx->codec->type != AVMEDIA_TYPE_VIDEO) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid media type for video\n");
+        return AVERROR(EINVAL);
+    }
+
     *got_picture_ptr = 0;
     if ((avctx->coded_width || avctx->coded_height) && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx))
         return -1;