aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_random.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-10-10 21:04:56 +0200
committerPaul B Mahol <onemda@gmail.com>2019-10-10 21:04:56 +0200
commitb67af536be1021f4babdffc548a14b4a68aadcb7 (patch)
treea2f62089528d0c056dd1e1447e89266584fed080 /libavfilter/vf_random.c
parentf6df99dba1ae64b05d08fba8160d13eb9795042f (diff)
downloadffmpeg-b67af536be1021f4babdffc548a14b4a68aadcb7.tar.gz
avfilter/vf_random: fix crash
Fixes #8235.
Diffstat (limited to 'libavfilter/vf_random.c')
-rw-r--r--libavfilter/vf_random.c5
1 files changed, 5 insertions, 0 deletions
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;