[FFmpeg-cvslog] lavf: check that the context to avformat_open_input() is valid.

Michael Niedermayer git at videolan.org
Wed Apr 18 15:35:20 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Apr 18 13:49:07 2012 +0200| [9f39d3d1908dfb7764120a90cbf524e04e9ed199] | committer: Michael Niedermayer

lavf: check that the context to avformat_open_input() is valid.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/utils.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 0636742..1bf5ac5 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -589,6 +589,10 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma
 
     if (!s && !(s = avformat_alloc_context()))
         return AVERROR(ENOMEM);
+    if (!s->av_class){
+        av_log(0, AV_LOG_ERROR, "Input context has not been properly allocated by avformat_alloc_context() and is not NULL either\n");
+        return AVERROR(EINVAL);
+    }
     if (fmt)
         s->iformat = fmt;
 



More information about the ffmpeg-cvslog mailing list