Message ID | 1580392997-12703-1-git-send-email-mypopydev@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [FFmpeg-devel,V1] cmdutils: fix crash if no name for "ffmpeg -h protocol" | expand |
Context | Check | Description |
---|---|---|
andriy/ffmpeg-patchwork | success | Make fate finished |
lgtm On 1/30/20, Jun Zhao <mypopydev@gmail.com> wrote: > From: Jun Zhao <barryjzhao@tencent.com> > > fix crash when used the command like: > - ffmpeg -h protocol > - ffmpeg -h protocol= > > Signed-off-by: Jun Zhao <barryjzhao@tencent.com> > --- > fftools/cmdutils.c | 8 +++++++- > 1 files changed, 7 insertions(+), 1 deletions(-) > > diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c > index 2284631..f0f2b4f 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; > -- > 1.7.1 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> 在 2020年1月30日,下午10:03,Jun Zhao <mypopydev@gmail.com> 写道: > > From: Jun Zhao <barryjzhao@tencent.com> > > fix crash when used the command like: > - ffmpeg -h protocol > - ffmpeg -h protocol= > > Signed-off-by: Jun Zhao <barryjzhao@tencent.com> > --- > fftools/cmdutils.c | 8 +++++++- > 1 files changed, 7 insertions(+), 1 deletions(-) > > diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c > index 2284631..f0f2b4f 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; > -- > 1.7.1 > fix it in avio_protocol_get_class is better than here. so i have send the other patch to fix this problem. > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". Steven Thanks
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 2284631..f0f2b4f 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;