avfilter/vf_random: fix crash
authorPaul B Mahol <onemda@gmail.com>
Thu, 10 Oct 2019 19:04:56 +0000 (21:04 +0200)
committerPaul B Mahol <onemda@gmail.com>
Thu, 10 Oct 2019 19:04:56 +0000 (21:04 +0200)
Fixes #8235.

libavfilter/vf_random.c

index 373a7db..1937eae 100644 (file)
@@ -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;