Avoid a null pointer dereference in avcodec_decode_video2().

This could happen if oom occured while probing a file.
Reported in ticket #1900.
This commit is contained in:
Carl Eugen Hoyos 2013-06-27 14:03:16 +02:00
parent f91833210e
commit 41f3c60fbb
1 changed files with 2 additions and 0 deletions

View File

@ -1920,6 +1920,8 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
// copy to ensure we do not change avpkt
AVPacket tmp = *avpkt;
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);