From 8140b51aa45427bd951646775f6c3221271f35d2 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 14 Sep 2017 14:55:35 +0500 Subject: [PATCH] Fix T52739: Crash loading corrupted video files Affects both "normal" open as a video file and thumbnail generation. --- source/blender/imbuf/intern/anim_movie.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 9806ff006d7..5bb91efe186 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -513,6 +513,11 @@ static int startffmpeg(struct anim *anim) avformat_close_input(&pFormatCtx); return -1; } + if (pCodecCtx->pix_fmt == AV_PIX_FMT_NONE) { + avcodec_close(anim->pCodecCtx); + avformat_close_input(&pFormatCtx); + return -1; + } frame_rate = av_get_r_frame_rate_compat(pFormatCtx->streams[videoStream]); if (pFormatCtx->streams[videoStream]->nb_frames != 0) {