[FFmpeg-devel] [PATCH]Fix null pointer dereference on audio probing

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Jun 28 16:01:38 CEST 2013


Hi!

Attached patch fixes - analog to 41f3c60 - a null pointer dereference if oom 
occurs while probing audio, should fix ticket #2722.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index e0819f4..7c7e352 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);


More information about the ffmpeg-devel mailing list