[FFmpeg-cvslog] segafilm: Validate the number of audio channels

Martin Storsjö git at videolan.org
Tue Oct 8 01:11:31 CEST 2013


ffmpeg | branch: release/1.1 | Martin Storsjö <martin at martin.st> | Thu Sep 19 16:02:29 2013 +0300| [5379c5184b9fe9ef06234638f5629d4c80056e04] | committer: Luca Barbato

segafilm: Validate the number of audio channels

This avoids divisions by zero later.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit 82e266c6d3fbf3cc74e515b883e66543381a0f2c)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

 libavformat/segafilm.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index adf2475..5643f33 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -111,6 +111,11 @@ static int film_read_header(AVFormatContext *s)
             return AVERROR(EIO);
         film->audio_samplerate = AV_RB16(&scratch[24]);
         film->audio_channels = scratch[21];
+        if (!film->audio_channels || film->audio_channels > 2) {
+            av_log(s, AV_LOG_ERROR,
+                   "Invalid number of channels: %d\n", film->audio_channels);
+            return AVERROR_INVALIDDATA;
+        }
         film->audio_bits = scratch[22];
         if (scratch[23] == 2)
             film->audio_type = AV_CODEC_ID_ADPCM_ADX;



More information about the ffmpeg-cvslog mailing list