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 committed by Bastien Montagne
parent cdc35e63bd
commit 9c39f021ad
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) {