From b67af536be1021f4babdffc548a14b4a68aadcb7 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Thu, 10 Oct 2019 21:04:56 +0200 Subject: [PATCH] avfilter/vf_random: fix crash Fixes #8235. --- libavfilter/vf_random.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavfilter/vf_random.c b/libavfilter/vf_random.c index 373a7db053..1937eae771 100644 --- a/libavfilter/vf_random.c +++ b/libavfilter/vf_random.c @@ -97,8 +97,13 @@ static int request_frame(AVFilterLink *outlink) ret = ff_request_frame(ctx->inputs[0]); +next: if (ret == AVERROR_EOF && !ctx->is_disabled && s->nb_frames > 0) { AVFrame *out = s->frames[s->nb_frames - 1]; + if (!out) { + s->nb_frames--; + goto next; + } out->pts = s->pts[s->flush_idx++]; ret = ff_filter_frame(outlink, out); s->frames[s->nb_frames - 1] = NULL;