[FFmpeg-cvslog] lavf: don't segfault when a NULL filename is passed to avformat_open_input( )

Anton Khirnov git at videolan.org
Sat Jun 16 23:25:53 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri Jun 15 19:58:11 2012 +0200| [a5db8e4a1a5449cc7a61e963c9fa698a4f22131b] | committer: Anton Khirnov

lavf: don't segfault when a NULL filename is passed to avformat_open_input()

This can easily happen when the caller is using a custom AVIOContext.

Behave as if the filename was an empty string in this case.

CC: libav-stable at libav.org

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

 libavformat/utils.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index d7ba5a7..5450dc4 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -557,7 +557,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma
     }
 
     s->duration = s->start_time = AV_NOPTS_VALUE;
-    av_strlcpy(s->filename, filename, sizeof(s->filename));
+    av_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename));
 
     /* allocate private data */
     if (s->iformat->priv_data_size > 0) {



More information about the ffmpeg-cvslog mailing list