[FFmpeg-cvslog] avformat/hlsenc: fix cid 1401346 Dereferencing pointer error

Steven Liu git at videolan.org
Tue Feb 21 17:39:07 EET 2017


ffmpeg | branch: master | Steven Liu <lq at chinaffmpeg.org> | Tue Feb 21 23:38:39 2017 +0800| [0c0aef1caf0cb5dd3b294f9fff923175036bd985] | committer: Steven Liu

avformat/hlsenc: fix cid 1401346  Dereferencing pointer error

check if proto is null before av_strcasecmp
CID:  1401346

Signed-off-by: Steven Liu <lq at chinaffmpeg.org>

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

 libavformat/hlsenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index e673f59..86a3b05 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -668,11 +668,11 @@ static void hls_free_segments(HLSSegment *p)
 static void set_http_options(AVFormatContext *s, AVDictionary **options, HLSContext *c)
 {
     const char *proto = avio_find_protocol_name(s->filename);
-    int http_base_proto = !av_strcasecmp(proto, "http") || !av_strcasecmp(proto, "https");
+    int http_base_proto = proto ? (!av_strcasecmp(proto, "http") || !av_strcasecmp(proto, "https")) : 0;
 
     if (c->method) {
         av_dict_set(options, "method", c->method, 0);
-    } else if (proto && http_base_proto) {
+    } else if (http_base_proto) {
         av_log(c, AV_LOG_WARNING, "No HTTP method set, hls muxer defaulting to method PUT.\n");
         av_dict_set(options, "method", "PUT", 0);
     }



More information about the ffmpeg-cvslog mailing list