Fix T52739: Crash loading corrupted video files

Affects both "normal" open as a video file and thumbnail generation.
This commit is contained in:
Sergey Sharybin 2017-09-14 14:55:35 +05:00
parent c57636f060
commit 8140b51aa4
Notes: blender-bot 2023-02-14 06:54:28 +01:00
Referenced by issue #53683, 2.79a release
Referenced by issue #52739, Thumbnail preview crash
1 changed files with 5 additions and 0 deletions

View File

@ -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) {