[FFmpeg-cvslog] avfilter/vf_random: fix crash

Paul B Mahol git at videolan.org
Thu Oct 10 22:06:43 EEST 2019


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Oct 10 21:04:56 2019 +0200| [b67af536be1021f4babdffc548a14b4a68aadcb7] | committer: Paul B Mahol

avfilter/vf_random: fix crash

Fixes #8235.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b67af536be1021f4babdffc548a14b4a68aadcb7
---

 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;



More information about the ffmpeg-cvslog mailing list