Skip to content
Snippets Groups Projects
Commit 41f3c60f authored by Carl Eugen Hoyos's avatar Carl Eugen Hoyos
Browse files

Avoid a null pointer dereference in avcodec_decode_video2().

This could happen if oom occured while probing a file.
Reported in ticket #1900.
parent f9183321
No related branches found
No related tags found
No related merge requests found
...@@ -1920,6 +1920,8 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi ...@@ -1920,6 +1920,8 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
// copy to ensure we do not change avpkt // copy to ensure we do not change avpkt
AVPacket tmp = *avpkt; AVPacket tmp = *avpkt;
if (!avctx->codec)
return AVERROR(EINVAL);
if (avctx->codec->type != AVMEDIA_TYPE_VIDEO) { if (avctx->codec->type != AVMEDIA_TYPE_VIDEO) {
av_log(avctx, AV_LOG_ERROR, "Invalid media type for video\n"); av_log(avctx, AV_LOG_ERROR, "Invalid media type for video\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment