From b42bcaef29e6ffcd9513e1ad92dbff07bea84c94 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos <cehoyos@ag.or.at> Date: Mon, 1 Jul 2013 03:07:44 +0200 Subject: [PATCH] Avoid a null pointer dereference in avcodec_decode_audio4(). This could happen if oom occured while probing a file. Fixes ticket #2722. --- libavcodec/utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index e659cc546c2..f26e260d3d7 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2061,6 +2061,8 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n"); return AVERROR(EINVAL); } + if (!avctx->codec) + return AVERROR(EINVAL); if (avctx->codec->type != AVMEDIA_TYPE_AUDIO) { av_log(avctx, AV_LOG_ERROR, "Invalid media type for audio\n"); return AVERROR(EINVAL); -- GitLab