[FFmpeg-cvslog] lavfi/af_amerge: check for buffer queue overflows.

Nicolas George git at videolan.org
Thu Jan 31 21:15:43 CET 2013


ffmpeg | branch: master | Nicolas George <nicolas.george at normalesup.org> | Thu Jan 31 14:24:57 2013 +0100| [ae14887ee7f2a2c02957845b84afd711cf702b9b] | committer: Nicolas George

lavfi/af_amerge: check for buffer queue overflows.

Without that test, ff_bufqueue_add silently discards the
oldest buffer, that leaves in[i].nb_samples inconsistent,
and causes later a segfault.

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

 libavfilter/af_amerge.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c
index 44b71e4..e552682 100644
--- a/libavfilter/af_amerge.c
+++ b/libavfilter/af_amerge.c
@@ -231,6 +231,11 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *insamples)
         if (inlink == ctx->inputs[input_number])
             break;
     av_assert1(input_number < am->nb_inputs);
+    if (ff_bufqueue_is_full(&am->in[input_number].queue)) {
+        av_log(ctx, AV_LOG_ERROR, "Buffer queue overflow\n");
+        avfilter_unref_buffer(insamples);
+        return AVERROR(ENOMEM);
+    }
     ff_bufqueue_add(ctx, &am->in[input_number].queue, insamples);
     am->in[input_number].nb_samples += insamples->audio->nb_samples;
     nb_samples = am->in[0].nb_samples;



More information about the ffmpeg-cvslog mailing list