Message ID | 20200823095039.18851-1-andreas.rheinhardt@gmail.com |
---|---|
State | Accepted |
Commit | 95b8df687cc0182a4ec7666c2bbc2826c9ef0852 |
Headers | show |
Series | [FFmpeg-devel,1/3] avfilter/graphparser: Fix leaks when parsing inputs fails | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
Andreas Rheinhardt (12020-08-23): > parse_filter() did not check the return value of av_get_token() for > success; in case name (the name of a filter) was NULL, one got a > segfault in av_strlcpy() (called from create_filter()). > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> > --- > libavfilter/graphparser.c | 7 +++++++ > 1 file changed, 7 insertions(+) LGTM. Regards,
diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c index e96b20418e..a52916a146 100644 --- a/libavfilter/graphparser.c +++ b/libavfilter/graphparser.c @@ -186,9 +186,16 @@ static int parse_filter(AVFilterContext **filt_ctx, const char **buf, AVFilterGr char *name = av_get_token(buf, "=,;["); int ret; + if (!name) + return AVERROR(ENOMEM); + if (**buf == '=') { (*buf)++; opts = av_get_token(buf, "[],;"); + if (!opts) { + av_free(name); + return AVERROR(ENOMEM); + } } ret = create_filter(filt_ctx, graph, index, name, opts, log_ctx);
parse_filter() did not check the return value of av_get_token() for success; in case name (the name of a filter) was NULL, one got a segfault in av_strlcpy() (called from create_filter()). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- libavfilter/graphparser.c | 7 +++++++ 1 file changed, 7 insertions(+)