mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avfilter/graphparser: Check allocations for success
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()). Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
f33faa5b9b
commit
95b8df687c
@ -186,9 +186,16 @@ static int parse_filter(AVFilterContext **filt_ctx, const char **buf, AVFilterGr
|
|||||||
char *name = av_get_token(buf, "=,;[");
|
char *name = av_get_token(buf, "=,;[");
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (!name)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
if (**buf == '=') {
|
if (**buf == '=') {
|
||||||
(*buf)++;
|
(*buf)++;
|
||||||
opts = av_get_token(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);
|
ret = create_filter(filt_ctx, graph, index, name, opts, log_ctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user