[FFmpeg-cvslog] cmdutils: fix crash if no name for "ffmpeg -h protocol"

Jun Zhao git at videolan.org
Thu Jan 30 18:07:48 EET 2020


ffmpeg | branch: master | Jun Zhao <barryjzhao at tencent.com> | Thu Jan 30 22:03:17 2020 +0800| [b99ed6e4287ccc4dcaf3c5133e9ec62d4ddb5bc6] | committer: James Almer

cmdutils: fix crash if no name for "ffmpeg -h protocol"

fix crash when used the command like:
- ffmpeg -h protocol
- ffmpeg -h protocol=

Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>

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

 fftools/cmdutils.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 22846317c1..f0f2b4fde4 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1872,8 +1872,14 @@ static void show_help_demuxer(const char *name)
 
 static void show_help_protocol(const char *name)
 {
-    const AVClass *proto_class = avio_protocol_get_class(name);
+    const AVClass *proto_class;
 
+    if (!name) {
+        av_log(NULL, AV_LOG_ERROR, "No protocol name specified.\n");
+        return;
+    }
+
+    proto_class = avio_protocol_get_class(name);
     if (!proto_class) {
         av_log(NULL, AV_LOG_ERROR, "Unknown protocol '%s'.\n", name);
         return;



More information about the ffmpeg-cvslog mailing list