Skip to content

Commit

Permalink
avfilter/avfilter: fix OOM case for default activate
Browse files Browse the repository at this point in the history
Fixes OOM when caller keeps adding frames into filtergraph
that reached EOF by other means, for example EOF is signalled
by other filter in filtergraph or by buffersink.
  • Loading branch information
richardpl committed Dec 3, 2023
1 parent e3e3531 commit d9e41ea
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libavfilter/avfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,16 @@ static int ff_filter_activate_default(AVFilterContext *filter)
{
unsigned i;

for (i = 0; i < filter->nb_outputs; i++) {
int ret = filter->outputs[i]->status_in;

if (ret) {
for (int j = 0; j < filter->nb_inputs; j++)
ff_inlink_set_status(filter->inputs[j], ret);
return 0;
}
}

for (i = 0; i < filter->nb_inputs; i++) {
if (samples_ready(filter->inputs[i], filter->inputs[i]->min_samples)) {
return ff_filter_frame_to_filter(filter->inputs[i]);
Expand Down

0 comments on commit d9e41ea

Please sign in to comment.