History

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()).

Andreas Rheinhardt committed 6 years ago

Commit 95b8df61 parent f33faa51 file · +7 −0Browse files

Showing the changes to libavfilter/graphparser.c (1 of 1 file). Show all

Unified · Split

libavfilter/graphparser.c+7−0
@@ -186,9 +186,16 @@ static int parse_filter(AVFilterContext **filt_ctx, const char **buf, AVFilterGr · 185 unmodified lines
186186 char *name = av_get_token(buf, "=,;[");
187187 int ret;
188188
189+ if (!name)
190+ return AVERROR(ENOMEM);
191+
189192 if (**buf == '=') {
190193 (*buf)++;
191194 opts = av_get_token(buf, "[],;");
195+ if (!opts) {
196+ av_free(name);
197+ return AVERROR(ENOMEM);
198+ }
192199 }
193200
194201 ret = create_filter(filt_ctx, graph, index, name, opts, log_ctx);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t