ffmpeg | branch: release/4.2 | James Almer <[email protected]> | Mon Dec 30 
00:25:41 2024 -0300| [20dee7be59c8f1ed8b02c89c206f56c77cff61dc] | committer: 
Michael Niedermayer

avfilter/buffersrc: check for valid sample rate

A sample rate <= 0 is invalid.

Fixes an assert in ffmpeg_enc.c that assumed a valid sample rate would be set.
Fixes ticket #11385.

Signed-off-by: James Almer <[email protected]>
(cherry picked from commit 1446e37d3d032e1452844778b3e6ba2c20f0c322)

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

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

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index e0ff7e4dd8..35da02990c 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -372,6 +372,11 @@ static av_cold int init_audio(AVFilterContext *ctx)
     if (!(s->fifo = av_fifo_alloc(sizeof(AVFrame*))))
         return AVERROR(ENOMEM);
 
+    if (s->sample_rate <= 0) {
+        av_log(ctx, AV_LOG_ERROR, "Sample rate not set\n");
+        return AVERROR(EINVAL);
+    }
+
     if (!s->time_base.num)
         s->time_base = (AVRational){1, s->sample_rate};
 

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to