From: Andriy Gelman <andriy.gel...@gmail.com>

Fixes #7985
This patch checks that the number of audio channels is not zero when
writing the total sample count in adx header.
---
 libavformat/rawenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index 993d232b70..bf8537fffb 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -65,6 +65,9 @@ static int adx_write_trailer(AVFormatContext *s)
     AVIOContext *pb = s->pb;
     AVCodecParameters *par = s->streams[0]->codecpar;
 
+    if (par->channels == 0)
+      return AVERROR_INVALIDDATA;
+
     if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
         int64_t file_size = avio_tell(pb);
         uint64_t sample_count = (file_size - 36) / par->channels / 18 * 32;
-- 
2.22.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to