[FFmpeg-cvslog] Avoid a null pointer dereference in avcodec_decode_video2().

Carl Eugen Hoyos git at videolan.org
Fri Jun 28 10:19:32 CEST 2013


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Thu Jun 27 14:03:16 2013 +0200| [41f3c60fbb7420f41295c8e0cf80acf9e71f72d0] | committer: Carl Eugen Hoyos

Avoid a null pointer dereference in avcodec_decode_video2().

This could happen if oom occured while probing a file.
Reported in ticket #1900.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=41f3c60fbb7420f41295c8e0cf80acf9e71f72d0
---

 libavcodec/utils.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 9fe3a16..e0819f4 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -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);



More information about the ffmpeg-cvslog mailing list