[FFmpeg-devel] [PATCH 2/2] lavfi/avf_concat: check input timestamp.

Nicolas George george at nsup.org
Sun Aug 9 13:56:53 EEST 2020


If an input has an undefined timestamp, the computation
for silence at stitches can overflow.

Partial fix for trac ticket #8843.

Signed-off-by: Nicolas George <george at nsup.org>
---
 libavfilter/avf_concat.c | 4 ++++
 1 file changed, 4 insertions(+)


"Partial fix" means it does not segfault and exits with an error instead.

The actual problem in this ticket is amix sending a frame with no PTS.


diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c
index 246628498a..f376f72754 100644
--- a/libavfilter/avf_concat.c
+++ b/libavfilter/avf_concat.c
@@ -179,6 +179,10 @@ static int push_frame(AVFilterContext *ctx, unsigned in_no, AVFrame *buf)
     AVFilterLink *outlink = ctx->outputs[out_no];
     struct concat_in *in = &cat->in[in_no];
 
+    if (buf->pts == AV_NOPTS_VALUE) {
+        av_log(ctx, AV_LOG_ERROR, "Frame without timestamp on input %d\n", in_no);
+        return AVERROR(EINVAL);
+    }
     buf->pts = av_rescale_q(buf->pts, inlink->time_base, outlink->time_base);
     in->pts = buf->pts;
     in->nb_frames++;
-- 
2.27.0



More information about the ffmpeg-devel mailing list